I'm looking for a way to have a custom 404 error page that will appear in function of the language of the site.
So far I have created my error.php and I put it there : "templates/YourTemplate/error.php"
<?php defined('_JEXEC') or die;
if ($this->error->getCode() == '404') {
header("HTTP/1.0 404 Not Found");
echo file_get_contents(JURI::root().'./error-404');
exit;
}
I also created my hidden menu with a blog view set to all language with the alias error-404. This menu to the articles from the "error-404" category (all language).
I can't have to alias for the same article so created the French article with error-404 and I also created the English categories with error-404-en alias. Finally, I created an association to link the two article together.
I have set every element to "no index / no follow".
I know that I could create a new template for one language and set the other one for the other language with their specific error.php, but I would like to keep the same template for both languages.
Thanks for your help!