: How to noindex a 404 page using .htaccess? I have several 404 not found pages which I would like to noindex through .htaccess. how do I do it with X-Robots-Tag?
I have several 404 not found pages which I would like to noindex through .htaccess.
how do I do it with X-Robots-Tag?
More posts by @Lengel546
1 Comments
Sorted by latest first Latest Oldest Best
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.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.