404 page does not work when SEF is enabled

Discuss Search Engine Optimization in relation to Joomla! 4.x. This forum will also have discussions on SEF/SEO Joomla! 4.x extensions.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
cjsmiff
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Wed Sep 26, 2007 2:05 am

404 page does not work when SEF is enabled

Post by cjsmiff » Thu Feb 24, 2022 1:26 pm

I am using Joomla 4.1.0 and have a problem with the error.php for 404 page, it redirects non existing urls to the home page. The issue occurs when enabling Joomla SEF URLs (yes .htaccess is enabled). I have tried using Joomla default template and error.php file but the problem persists. I have searched high and low for a solution and nothing I try works. I ended up here: viewtopic.php?f=816&t=991546 which may or may not be the same issue.

smartestlancer
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Thu Feb 24, 2022 10:21 pm

Re: 404 page does not work when SEF is enabled

Post by smartestlancer » Thu Feb 24, 2022 11:01 pm

If you have a .htaccess file then You can force to load your 404 page by .htaccess file:

ErrorDocument 404 http://yourdomain.com/404.php
Put it on top of your .htaccess file

EDIT: Replace http://yourdomain.com/404.php with your Joomla 404 URL.

Let me know if it works or not.

Thanks

cjsmiff
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Wed Sep 26, 2007 2:05 am

Re: 404 page does not work when SEF is enabled

Post by cjsmiff » Thu Feb 24, 2022 11:34 pm

smartestlancer wrote:
Thu Feb 24, 2022 11:01 pm
If you have a .htaccess file then You can force to load your 404 page by .htaccess file:

ErrorDocument 404 http://yourdomain.com/404.php
Put it on top of your .htaccess file

EDIT: Replace http://yourdomain.com/404.php with your Joomla 404 URL.

Let me know if it works or not.

Thanks
Hi, thank you but this is one of the many suggestions I have tried.

It happens with all of my 4.5+ installations, each with different plugins etc and templates. And it only happens when turning SEF on in global configuration.

mib1980
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Mon Jul 11, 2022 6:57 pm

Re: 404 page does not work when SEF is enabled

Post by mib1980 » Mon Jul 11, 2022 7:00 pm

I have exactly the same problem. Any news on this matter?

mib1980
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Mon Jul 11, 2022 6:57 pm

Re: 404 page does not work when SEF is enabled

Post by mib1980 » Sat Jul 16, 2022 4:52 pm

I could finally solve my problem in 2 steps:

1. I could specify the menu ID for the 404 redirect within the settings of my Joomla template (Gavick Hubs). For whatever reason, the ID was not correctly set this way. I had to change the error.php file manually.

2. 404 errors are not redirected to the defined error page until the website is online. 404 errors are automatically redirected to .../index.php when you're in offline mode and logged in as an administrator.


Locked

Return to “Search Engine Optimization (Joomla! SEO) in Joomla! 4.x”