2
votes

I'm having issues with my Joomla installation. It's a rather vanilla J! 2.5 (latest version) installation with K2 (I don't think it is related to my problem). The problem is that any URL I make up (such as http://www.mysite.com/No-Such-URL-At-All) gives me the following error:

Error Article not found You are not authorised to view this resource.

I created an error.php file that should handle it in the template, but it is not used at all by Joomla, as I don't think it is really handled as error but as a permission redirection :\

So I tried adding this code to my template:

Code:

if (($this->error->code) == '404') {
header('Location: /404.html');
exit;   

But no error was detected and the code was also ignored.

I inspected the response headers from the server, but I actually get a response 200, OK response :.

Some additional data that could be usefull - It's hosted on a godaddy dedicated centos server - SEF is enabled (problem continues also when disabled) Let me know if any other information could help...

I really have no other direction I can think of, maybe someone has any idea why any 404 is turned into a permission redirection?

1
You can enable debug to see if there is any useful info about where the error is raised, for example: JError::raiseError() components/com_content/models/article.php:172 JError::raise() libraries/joomla/error/error.php:251 - Hung Tran

1 Answers

2
votes

Check to see if when you have a 404 if Joomla is hitting the "com_content" component ( check the $_REQUEST variable). I had this problem and it turned out that it wasn't, it was hitting one of my custom components. If this is the case, here is what you need to do to fix it. For this example, lets say that its hitting 'com_home' instead of 'com_content'.

1). Copy components/com_content/router.php into components/com_home

2). Open components/com_home/router.php and replace all instances of "Content" with "home"

3). Open components/com_home/home.php and add the following lines near the top of the file:

JHtml::_('behavior.tabstate');
require_once JPATH_COMPONENT.'/helpers/route.php';

4). Copy the entire components/com_content/helpers into components/com_home

When that's done, the url mysite.com/does-not-exist should redirect to the error.php page you've set up in your template.