In this documentation


there is advice to redirect to a custom 404 page by redirecting. This leads to the final page being served on a Header 200 code.

However this webmaster tools article


requires the 404 error page to return a 404 header.

I have tried to include Joomla again from the error page. Short of using curl to get the custom page, is there anything else I can do?

3 Answers 3


This is called a soft 404 as you are redirecting to a different URL. So the 200 response after the redirect is correct, which, yes, does cause problems for search engine bots in determining if content is not found:

I was going to suggest, forcing a 404 response code to header call in error.php file like this:

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

However, this won't work — mainly because browser behaviour is either to go no further or undefined as far as I can tell (see 4xx errors, 404) which conflicts with location. (Also some Chrome & IE's et al ignore the content provided by the server when they see a 404 code and present their own "suggestions").

So, it would appear that to get custom content from an article and retain a 404 you need to get that content and include it in your error page (I'm presuming you want to do this so that you get your template, menu structure etc).


Here is what I ended up placing at the top of my error.php

 * @package     Joomla.Site
 * @subpackage  Template.system
 *   * @copyright   Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights     reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 defined('_JEXEC') or die;
if (($this->error->getCode()) == '404') {
    header('HTTP/1.0 404 Not Found');
    $ch = curl_init( JURI::root() . '/404');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    echo curl_exec($ch);
  • This worked for me. The setting of the header and the exit are important. You could also do a file_get_contents instead of a curl.
    – Klaasvaak
    Oct 16, 2014 at 9:40
  • @klaasvaak and jdog.. please try this tool: test404page.com and tell me if this returns to you a 404 header. In my case, it returns nothing although i have set a similar error.php Thanks.. Aug 21, 2015 at 8:01
  • @yannis dran I know it works for me because of what I see in Chrome inspector. Whats your website? Can you put up a separate question for your problem?
    – jdog
    Sep 16, 2015 at 22:47
  • it is not only one website, but a few of them. I can't find the request in inspector. Can you please tell me how you found it? I checked several other websites and the same problem occurs that's why I asked. I don't think it worths a seperate question. Sep 17, 2015 at 9:22

Pretty easy fix for Joomla custom soft 404 URLs that don't return the 404 header:


Visible on: https://www.its-acoustique.fr/john-doe

  • 1
    Please always write the core/bulk of your answer as text in your answer. Link-only answers are low value on StackExchange sites because when the links die, the post becomes useless. Please take a moment to edit/improve this answer so that it is timeless and educational without leaving this site. Linking to external resources helps to fortify answers, so definitely don't delete them. Oct 19, 2018 at 10:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.