Blocking Google via htaccess

falboe

Registered Member
Joined
May 8, 2014
Messages
94
Reaction score
20
Hi, I want to block in the htaccess url file (https://www.example.com/files/example/index.php) for Google robots. Searching through the search engine I found something like:

RewriteEngine on
RewriteCond% {HTTP_USER_AGENT} Googlebot [OR]
RewriteRule ^. * $ "Http \: \ / \ / yordomain \ .com" [R = 301, L]

This file is for the domain, and I want to block a specific url, how can I save it?
 
This should do the thing:

1. Create a new .htaccess file
2. Find a list of Google IP's:

for example I quickly found this one:
  • 64.68.90.1 – 64.68.90.255
  • 64.233.173.193 – 64.233.173.255
  • 66.249.64.1 – 66.249.79.255
  • 216.239.33.96 – 216.239.59.128
3. Convert these to CIDR at ip2cidr.com
4. Add the following code to your .htaccess file:
***
Order Deny,Allow
Deny from 64.68.90.1/32
Deny from 64.68.90.2/31
Deny from 64.68.90.4/30
Deny from 64.68.90.8/29
Deny from 64.68.90.16/28
Deny from 64.68.90.32/27
Deny from 64.68.90.64/26
Deny from 64.68.90.128/25
...etc
***
(all records that you received on step3 should be listed here with prepended "Deny from ")

5. upload this .htaccess file to a folder example.com/files/example/
 
Back
Top