Reputation: 1
My site was hacked some time before and we caught this issue and cleaned the site but now we are dealing with a ton of fake, bogus links created by the hackers on other website pointing to pages that do not exists on our server.
We have our htaccess
setup to deliver a custom 404 page for any search bots and/or visitor who may come to our site from a bogus link. Google
is finding these bogus link out there on the web and keeps trying to index them.
I have read that I should be giving a 410 (gone)
code to google
instead of a 404 (not found)
because Google treats the 410
more strongly then a 404
. My problem is that I do not know how to deliver a 410 error
code instead of a 404 error
to google
from my htaccess
.
If anyone can help me with this I would really be appreciative. Again, I want to give a 410
code for ALL files that are not found and direct a user to a special page stating that the file they requested is gone.
Upvotes: 0
Views: 1201
Reputation: 5340
Response 410 code for the files not exists:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ - [L,R=410]
Setting a custom 410 error page like this:
ErrorDocument 410 /410.html
Upvotes: 1