sigil88
5/19/2017 - 9:14 AM

Joomla - error pages https://docs.joomla.org/Creating_a_Custom_404_Error_Page

1. Copy system/error.php to template root
2. Add php after jexec check:

<?php
/*-------  custom error pages - redirect to article pages  ------*/
/*-------     disallowed article pages in robots.txt      -------*/

/* 400 - bad request */
if (($this->error->getCode()) == '400') {
header('Location: /index.php/error-400');
exit;
}

/* 401 - not authorised */
if (($this->error->getCode()) == '401') {
header('Location: /index.php/error-401');
exit;
}

/* 403 - forbidden */
if (($this->error->getCode()) == '403') {
header('Location: /index.php/error-403');
exit;
}

/* 404 - not found */
if (($this->error->getCode()) == '404') {
header('Location: /index.php/error-404');
exit;
}

/*-----         end custom error page redirect        -----*/ 
?>

3. Create article & menu item for the custom error pages.

4. Exclude your Custom 404 Error Page from Search Engines:

In Joomla 3.x: in Article Manager > Edit Article > [Publishing] > set "Robots" to "Noindex".
OR:
Disallow: /index.php/error-404