Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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. – w3dk Apr 10 '14 at 10:39

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]

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

share|improve this answer

Your Answer


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.