Robert E
Robert E

Reputation: 750

Set 410 status in unique scenarios

I have discovered some of my dev sites have been indexed by Google. Somehow the robots.txt was removed. How can I tweak my .htaccess to give a 410 status if the visitor is the google spider bot OR the visit is a referral from google?

Upvotes: 0

Views: 167

Answers (1)

Croises
Croises

Reputation: 18671

You can use in your .htaccess:

RewriteEngine On 
RewriteCond %{HTTP_USER_AGENT} Googlebot [OR]
RewriteCond %{HTTP_REFERER} google
RewriteRule ^ - [L,R=410]

Upvotes: 1

Related Questions