User tests: Successful: Unsuccessful:
Pull Request resolves #46610
Added a <base> tag to the Cassiopeia error.php template header. This ensures that relative assets (like images in custom modules) load correctly when a 404 error occurs on a nested URL.
Ensure URL Rewriting is enabled in Global Configuration and the .htaccess file is active.
Go to Administrator > Content > Site Modules
Create a "Custom" module
Set the position to error-404 and assign it to "All Pages"
In the content editor, switch to code view and add an image with a relative path:
for eg: <img src="images/powered_by.png" alt="Test Logo">
Visit http://yourdomain.com/thispagedoesnotexist -> the custom page appears correctly and the image is also visible.
Visit http://yourdomain.com/category/thispagedoesnotexist -> the custom error page does not load the image.
The image fails to load , and the "Home pagee" button links to a non-existent path.
The image loads correctly, and the Home button correctly links to the site root.
Please select:
Documentation link for guide.joomla.org:
No documentation changes for guide.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
| Status | New | ⇒ | Pending |
| Category | ⇒ | Front End Templates (site) |
I have tested this item ✅ successfully on 652f4f8
Hi @krishnagandhicode, did you check multi-lingual sites? and multi-lingual sites that are running from a sub-domain?
I ask because while I do confirm the BEFORE and AFTER condition for:
The image fails to load and then The image loads correctly,
for the Home button, I can't seem to see any difference... (it could be simply that the Joomla router is handling things correctly...
Before I pass or fail this, I wanted to check with you.
Hi @krishnagandhicode, did you check multi-lingual sites? and multi-lingual sites that are running from a sub-domain?
I ask because while I do confirm the BEFORE and AFTER condition for: The image fails to load and then The image loads correctly,
for the Home button, I can't seem to see any difference... (it could be simply that the Joomla router is handling things correctly...
Before I pass or fail this, I wanted to check with you.
Yes Uri::base() automatically grabs the right physical root URL, also for sub-domains as well.
router handles multilingual sites as well.
You are right about the home button, The original issue (# 46610) mentioned about this ("Back to home page") and I also tested using laragon with joomla in a subfolder so the button actually did break for me, I believe you tested using a hosted site - so it works fine for you.
if the main issue - relative image path is fixed with the patch - then the fix works :)
I have tested this item ✅ successfully on 652f4f8
I have tested this successfully. I was indeed using a hosted site. Thanks @krishnagandhicode!
| Status | Pending | ⇒ | Ready to Commit |
| Labels |
Added:
bug
PR-5.4-dev
|
||
RTC
< base > seems entirely wrong here to me. The error template should explicitly use absolute paths for its own assets (it mostly already does via jdoc:include), and if users put relative paths in custom modules, that's a documentation/editor issue — not something to fix by globally rebasing all URLs on the error page.