How To: Joomla Redirect 404 Errors to 410 HTTP – Google Nuke Drop

How To: Joomla Redirect 404 Errors to 410 HTTP – Google Nuke Drop

If Google indexed a page you recently removed from your Joomla website and someone clicks the page from a Google search, your website returns a 404 HTTP message. A 404 HTTP message tells search engines like Google your web page is no longer available. Unfortunately, Google does not instantly drop your article from its search index results. In order to have Google drop removed content from your Joomla website instantly, you need to return a 410 HTTP message. This guide will show you how to change the default 404 error to be a 410 error.

 

1. If you haven’t done so yet, move a copy of error.php to your default template folder. Go to Your-Joomla-web-site/templates/system and download a copy of error.php. Move this file into your default Joomla template folder (i.e Your-Joomla-web-site/templates/mytemplate).





2. Add the following code to error.php right before //Get language and direction pictured below.

if ($this->error->getCode() == '404'){
    header("HTTP/1.0 410 Gone");
die;
}

Joomla redirect 404 response to 410 response error.php

 

3. Save the file. Now browse to your Joomla web page that no longer exists – your web browser should return a 410 response pictured below. You can also use this site.

SERVER RESPONSE: HTTP/1.1 410 Gone

Joomla return 410 response

* Please use the comment form below. Comments are moderated.*



Related Posts

 

Comments

No comments made yet. Be the first to submit a comment
Thursday, 25 April 2024