Error 404 Issue

Discuss Search Engine Optimization in relation to Joomla! 3.x. This forum will also have discussions on SEF/SEO Joomla! 3.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.
Post Reply
fabioweb90
Joomla! Apprentice
Joomla! Apprentice
Posts: 29
Joined: Tue Feb 09, 2016 11:02 am

Error 404 Issue

Post by fabioweb90 » Fri Oct 06, 2017 9:45 pm

Hello!
i'm not able to redirect to 404 page if url does not exists: https://www.casacasette.it/prova

What can i do?

I have this code in my error.php template..

if (($this->error->getCode()) == '404') {
header('Location: /index.php?option=com_content&view=article&id=23');
exit;
}

Regards

User avatar
jackrabbit
Joomla! Ace
Joomla! Ace
Posts: 1473
Joined: Thu May 21, 2009 3:12 am
Location: Florida
Contact:

Re: Error 404 Issue

Post by jackrabbit » Sat Oct 07, 2017 2:00 am

Try it with

Code: Select all

header('Location:'.Juri::base().'index.php?option=com_content&view=article&id=23');
Reset Joomla super user password and username simply | http://cmsenergizer.com/website-energy- ... d-remotely

fabioweb90
Joomla! Apprentice
Joomla! Apprentice
Posts: 29
Joined: Tue Feb 09, 2016 11:02 am

Re: Error 404 Issue

Post by fabioweb90 » Sat Oct 07, 2017 12:45 pm

Unfortunately is not working..

User avatar
jackrabbit
Joomla! Ace
Joomla! Ace
Posts: 1473
Joined: Thu May 21, 2009 3:12 am
Location: Florida
Contact:

Re: Error 404 Issue

Post by jackrabbit » Sat Oct 07, 2017 5:28 pm

Remove the single quotes from the error value and add a third =

Code: Select all

if( $this->error->getCode() ) ===404
Reset Joomla super user password and username simply | http://cmsenergizer.com/website-energy- ... d-remotely

fabioweb90
Joomla! Apprentice
Joomla! Apprentice
Posts: 29
Joined: Tue Feb 09, 2016 11:02 am

Re: Error 404 Issue

Post by fabioweb90 » Sun Oct 08, 2017 12:54 am

Okay so final result will be this?

Code: Select all

defined('_JEXEC') or die;

if( $this->error->getCode() ) === 404 {
header('Location:'.Juri::base().'index.php?option=com_content&view=article&id=23');
exit;
}

User avatar
jackrabbit
Joomla! Ace
Joomla! Ace
Posts: 1473
Joined: Thu May 21, 2009 3:12 am
Location: Florida
Contact:

Re: Error 404 Issue

Post by jackrabbit » Sun Oct 08, 2017 1:25 am

Yes.
Note that you do not have to write the URL in query format when SEF is enabled. It can simply be component/content/article/23

Code: Select all

if( $this->error->getCode() ) === 404 {
header('Location:'.Juri::base().'component/content/article/23');
exit;
}
Reset Joomla super user password and username simply | http://cmsenergizer.com/website-energy- ... d-remotely

fabioweb90
Joomla! Apprentice
Joomla! Apprentice
Posts: 29
Joined: Tue Feb 09, 2016 11:02 am

Re: Error 404 Issue

Post by fabioweb90 » Sun Oct 08, 2017 10:12 am

Okay i did but still not working.. I don't have any SEF extension un my website

fabioweb90
Joomla! Apprentice
Joomla! Apprentice
Posts: 29
Joined: Tue Feb 09, 2016 11:02 am

Re: Error 404 Issue

Post by fabioweb90 » Fri Oct 13, 2017 2:17 pm

Ok i have an update.. Problem was related from missing Virtuemart "Front page (deprecated)" which is the actual homepage of the website
Now first level menù item are correctly related to the 404 page.. The problem is for second level menù item like "Casette in legno 28mm" under "Casette in legno"

Why this difference from first level menù item and second level menù?

Regards


Post Reply

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