PR-6.0-dev Pending

User tests: Successful: Unsuccessful:

avatar KishoriBKarale
KishoriBKarale
31 Jan 2026

Pull Request for Issue #46610

Summary of Changes

Modified modules/mod_custom/tmpl/default.php to dynamically prepend the site root URI to relative image paths in the custom module content using preg_replace. This ensures that src attributes pointing to local images (e.g., images/foo.jpg) are converted to absolute or root-relative paths (e.g., /joomla_root/images/foo.jpg), preventing broken images when the module is displayed on nested URLs.

Testing Instructions

  1. Setup: Create or use an existing "Custom" module in Joomla.
  2. Content: specific an image in the content using a relative path (e.g., insert an image using the editor, which typically saves as src="images/your-image.jpg").
  3. Trigger: Navigate to a nested URL on the frontend. This can be a deep category page or a 404 page triggered by a non-existent sub-URL (e.g., your-site.com/index.php/category/fake-page).
  4. Verify: Check if the image in the custom module renders correctly.

Actual result BEFORE applying this Pull Request

When visiting a nested URL (e.g., site.com/group/page), the browser tries to resolve relative image paths relative to the current URL path (e.g., site.com/group/images/image.jpg). This results in a broken image link (404) because the image does not exist at that location.

Expected result AFTER applying this Pull Request

The code intercepts the content and prepends the correct site root to the image src. The browser now consistently loads the image from the correct root path (e.g., site.com/images/image.jpg) regardless of how deep the current page URL is. The image displays correctly on all pages.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar KishoriBKarale KishoriBKarale - open - 31 Jan 2026
avatar KishoriBKarale KishoriBKarale - change - 31 Jan 2026
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 31 Jan 2026
Category Modules Front End
avatar brianteeman
brianteeman - comment - 31 Jan 2026

This is not the correct fix. You are fixing the problem in the wrong place as you are assuming that the problem is only with that module

avatar Denitz
Denitz - comment - 31 Jan 2026

Invalid PR, please close. Relative images are loaded respecting <base> HTML tag, please fix your template instead.

avatar tecpromotion tecpromotion - change - 31 Jan 2026
The description was changed
avatar tecpromotion tecpromotion - edited - 31 Jan 2026
avatar tecpromotion tecpromotion - change - 31 Jan 2026
Title
[#46610] - Issue with custom 404 error page
[6.0] - Issue with custom 404 error page
avatar tecpromotion tecpromotion - change - 31 Jan 2026
Title
[6.0] - Issue with custom 404 error page
[#46610] [6.0] - Issue with custom 404 error page
avatar tecpromotion tecpromotion - edited - 31 Jan 2026
avatar joomla-cms-bot joomla-cms-bot - edited - 31 Jan 2026
avatar tecpromotion tecpromotion - change - 31 Jan 2026
Title
[#46610] [6.0] - Issue with custom 404 error page
[6.0] - Issue with custom 404 error page
avatar tecpromotion tecpromotion - change - 31 Jan 2026
Title
[6.0] - Issue with custom 404 error page
[#46610] [6.0] - Issue with custom 404 error page
avatar tecpromotion tecpromotion - edited - 31 Jan 2026
avatar joomla-cms-bot joomla-cms-bot - edited - 31 Jan 2026
avatar tecpromotion tecpromotion - change - 31 Jan 2026
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2026-01-31 12:53:20
Closed_By tecpromotion
Labels Added: PR-6.0-dev
avatar tecpromotion tecpromotion - close - 31 Jan 2026
avatar tecpromotion
tecpromotion - comment - 31 Jan 2026

Thank you for your PR @KishoriBKarale
However, this is incorrect and will therefore be closed.

avatar evaret
evaret - comment - 31 Jan 2026

Testing with an existing article the image the image displayed correctly.
Ttesting with a a non-existent sub-URL (e.g., your-site.com/index.php/category/fake-page) the image is not rendered.
Applying the fix solved the problem


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46797.

Add a Comment

Login with GitHub to post a comment