How to noindex a 404 page using .htaccess?
How to noindex a 404 page using .htaccess? -
Solution :
Additionally, if you would like to do some further testing, give the htaccess tester tool a try. It allows you to specify a certain URL as well as the rules you would like to include and then shows which rules were tested, which ones met the criteria, and which ones were executed.
.htaccess files are extremely useful in many cases for users who either do not have root permissions or for users who simply aren't comfortable in making changes in their web server's configuration file. Trying to debug .htaccess not working isn't always the easiest thing to do, however, hopefully by checking the discuss below mentioned about htaccess, 404, noindex, , .htaccess common problems as well as the troubleshooting tips, you'll have a better grasp on what you may have to modify to get your .htaccess file running smoothly.Problem :I have several 404 not found pages which I would like to noindex through .htaccess.
how do I do it with X-Robots-Tag?
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.
Comments
Post a Comment