Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By Ben E on
Hi all,
I have a site that I have recently converted to Drupal, so many of the old urls on the site are no longer valid. However, because Drupal generates its own 404 errors, these pages are not being deleted from search engine indices, and still show up when I search Google etc. Is there any way to get Drupal to send a real 404 for these old urls, so that the crawlers delete them?
cheers
Ben
Comments
Not tested...
If you want to permanently delete pages from crawlers, you need to look at "Redirect 410" rather than 404.
Locate the following in your .htaccess file:
Add the following directly above it:
Redirect 410 is a permanent "page gone" and should signal Google & other crawlers to remove the page. In case I've messed up the syntax, Google for "htaccess" and "redirect 410".
That should get you on the right track...
Thanks, that's definitely
Thanks, that's definitely the appropriate code. As usual Mark Pilgrim has a good page on the topic:
http://diveintomark.org/archives/2003/03/27/http_error_410_gone
I've got dozens of these pages, so I can't stick them all in .htaccess (or don't want to!), but I can use mod_rewrite to check for the old-style url - testing for the .html suffix should do it - then send the 410.
I'll give it a go, cheers
Ben