so I have a Joomla Website with a lot of content (10k+ items acumulated over the last 10 years).

I want to remove the Content of the first 5 Years because it costs a lot of Crawler Budget for Google. To do that I have to declare the page with the http 410 Status code - so it get permanently removed and google doesn't try to crawl it again and again.

So how can I manage that without editing each url by Hand? Is there a way to even remove Content in this way in joomla?

up vote 2 down vote accepted

I have never had to do something like this before.
However, I just had a somewhat awkward but certainly simple idea which could work for you.

Create a template override for the article view in:

/templates/YOUR_TEMPLATE/html/com_content/article/default.php

In default.php, just below the defined('_JEXEC') or die;

add the following:

$time = strtotime("-5 years", time());
$date = date("Y-m-d", $time);


if ($this->item->created < $date) {
    JError::raiseError(410, "This page isn't available any more and will never be available again in the future");
}

What this does is that it compares if the article created date is older than 5 years. If so, it will raise the system error page of joomla with 410 status code and message: "This page isn't available any more and will never be available again in the future".

Test this somewhere before doing anything on your live website.

  • what if there is no article? I wanna do this with old articles that are not on Joomla anymore, and google search console shows their URL as "404 - not found"? – kiasati Jul 11 at 7:22

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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