Thoughts, information and reflections about technology

Quick redirect to your home page in Joomla for 404 errors

Joomla provides an ugly 404 page that will probably cause most viewers to go elsewhere.

There are some more elegant solutions to replacing the 404 page than the one I’ll outline here. However, this is quick and easy.

This solution will only work if you are running Apache and have access to your configuration files. This solution is based on a Joomla 2.5.7 installation. Other versions may require a different approach

  • Locate your error.php.  It will be locate in a folder such as /var/www/html/templates/system
  • Back up the error.php file. (Ftp it down, rename it to error.old, ftp it back up)
  • Locate the following lines

defined(‘_JEXEC’) or die;
if (!isset($this->error)) {
$this->error = JError::raiseWarning(404, JText::_(‘JERROR_ALERTNOAUTHOR’));
$this->debug = false;

  • Insert a line as shown

defined(‘_JEXEC’) or die;
header (“Location: /”); exit();
if (!isset($this->error)) {
$this->error = JError::raiseWarning(404, JText::_(‘JERROR_ALERTNOAUTHOR’));
$this->debug = false;

This will redirect all 404’s to your home page. It worked fine on the first site I tried it on. I suspect there is a way to point this to a particular page instead of the home page but I haven’t had time to try to tweak it.


Similar Posts:

4 Responses to Quick redirect to your home page in Joomla for 404 errors

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact me
Amazon Disclosure

We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to and affiliated sites.