1

I'm having issues getting the proper 404 page (templates/MY_TEMPLATE/error.php) to work.

I've spent hours reading through and trying every example or fix listed on Stack Exchange and other sites with no luck.

Such threads as: return 404 header with 404 page and 404 HTTP codes in Joomla

I'm using the default .htaccess supplied with Joomla found here https://github.com/joomla/joomla-cms/blob/staging/htaccess.txt and in my global configuration I have url rewriting and search engine friendly urls enabled.

I've tried with url rewriting off, search engine friendly urls off, redirect plugin disabled, renaming .htaccess to htaccess.txt, setting header and exit in error.php (although, I don't think error.php is even being loaded since everything redirects immediately to the homepage).

I admittedly know little about .htaccess, but I have tried commenting some of the rewrite rules out and this one in particular

RewriteRule .* index.php [L]

is properly redirecting all real 404s to the error page, but index.php is present in all of my urls which is not desirable.

If anyone could offer any insight I would be most appreciative, thank you.

  • Has anybody found a solution for this problem? I have the same problem an I did not find a solution yet. – user9119 Oct 6 '16 at 17:46
2

index.php will always be present in the URL as long as you haven't enabled the option "Use URL Rewriting". If you enable that one in the global config, it will be removed.

Even 404 errors are going through the index.php because it's Joomla who decides if it's a 404 or not. It just renders a different "template" code (the error.php file) in the end.

  • That comes full circle to my original question, if I type in mysite.com/bad_url, it always redirects to the homepage. What I'd like to do is route those bad urls to the actual error.php page - which I cannot seem to do. – Tyler Ancell May 28 '15 at 16:37
  • If you have SEF enabled and URL rewriting enabled, it should do that with the default .htaccess rules. – Bakual May 28 '15 at 17:25
  • SEF and URL rewriting are enabled, and default .htaccess but any obvious bad urls are redirecting to "index.php" not error.php. It was happening to the fellow here joomla.stackexchange.com/questions/4616/… as well and there was no accepted solution (none of the solutions worked for me, either.) Like him, I think .htaccess is the culprit as nothing is even being directed to error.php, it just automatically goes to the homepage (index.php). – Tyler Ancell May 28 '15 at 17:42
  • Don't know then. It works fine for me with a default Joomla installation. Keep in mind that even when there is an error 404, it will still go through the /index.php. Every request always goes through that file. The error.php from the template just defines the design of the error page. – Bakual May 28 '15 at 21:08
  • @TylerAncell were able to find the solution? I am having exactly the same problem. First I thought that the template breaks it but I tried templates provided by default Joomla installation and it doesn't make a difference. – Insider Pro Mar 14 '16 at 0:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.