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
1

I got the same issue. My problem was that "Offline mode" in Global Configuration was set to "YES". Good luck.

New contributor
Alvin Konda is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • Thanks. Well i have 10 years experience with Joomla and i have build 100+ templates. Recently i have working with it again... – Alvin Konda yesterday
  • Terrific, but then why are we only meeting you now! ;) I look forward to seeing more of your posts. – mickmackusa yesterday
  • Well, i minded my own business and provided my own support. I used to own IceTheme.com – Alvin Konda yesterday
  • I am happy to see that you have come out of your shell. We need more volunteers with your level of experience here. – mickmackusa yesterday
  • 1
    Yes, i will bring someone else from my team who is experienced with Joomla as well. – Alvin Konda yesterday
0

I had the same issue in our "development system".

It turns out that the 404-Page is loaded correctly when the site is set to online in the config. But when the site is set to offline and i am logged in - any 404 redirects to the frontpage.

  • I don't want to ask a question. I only mentioned that the 404-page is not loaded correctly if the system is turned to offline like most systems are, when you are developing online. Sorry maybe i misunderstood the question... Edit: "(although, I don't think error.php is even being loaded since everything redirects immediately to the homepage)." -> This is what happens when the system is turned offline. – Neuland Medien Jun 3 '16 at 14:08

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.