Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have several 404 not found pages which I would like to noindex through .htaccess.

how do I do it with X-Robots-Tag?

share|improve this question
6  
If these are genuine 404 pages (ie. you are sending a 404 HTTP response header) then you shouldn't have to explicitly state that it's "noindex". Search engines won't (shouldn't!?) index a 404. –  w3d Apr 10 at 10:39

1 Answer 1

In your case, instead of preventing indexing for your 404 pages, you should consider to create a specific 404 page by adding this line in your .htaccess file:

ErrorDocument 404 /specific-404-page/

All your current 404 pages would be redirected to your specific 404 page and would be removed from search engines' index.

If your current 404 pages are old pages, you can return a 410 HTTP status (Gone) with these lines in your .htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} /first-page/ [OR]
RewriteCond %{REQUEST_URI} /second-page/ [OR]
RewriteCond %{REQUEST_URI} /third-page/
RewriteRule ^.*$ - [G]
</IfModule>

Theoretically, it helps search engines to remove pages quicker from their index.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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