1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to block google access using htaccess

Discussion in 'Black Hat SEO' started by tabish8612, Jun 1, 2013.

  1. tabish8612

    tabish8612 Power Member

    Joined:
    Sep 13, 2009
    Messages:
    504
    Likes Received:
    109
    Occupation:
    Online Marketing
    Location:
    In your home...COMPUTER
    Hi, Can anyone tell me how to block google access from reading /go/ folder it containing affiliate meta refresh file using htaccess file. I know how to block using robots.txt but want to know htaccess method.
     
  2. kasopise

    kasopise BANNED BANNED

    Joined:
    Jan 11, 2013
    Messages:
    126
    Likes Received:
    38
    htaccess is for write your URL with custom name !
     
  3. shubham44

    shubham44 Registered Member

    Joined:
    Mar 18, 2012
    Messages:
    56
    Likes Received:
    54
    found this on google
    Code:
    [FONT=Verdana]RewriteEngine on[/FONT]
    RewriteCond %{HTTP_USER_AGENT} AltaVista [OR]RewriteCond %{HTTP_USER_AGENT} Googlebot [OR]RewriteCond %{HTTP_USER_AGENT} msnbot [OR]RewriteCond %{HTTP_USER_AGENT} SlurpRewriteRule ^.*$ "http\:\/\/htmlremix\.com" [R=301,L]
    Code:
    www.htmlremix.com/seo/block-google-and-bots-using-htaccess-and-robots-txt
     
  4. theblackhatnoob

    theblackhatnoob Registered Member

    Joined:
    Mar 31, 2013
    Messages:
    59
    Likes Received:
    65
    Put the code in a .htaccess file and add it to the go folder.

    RewriteEngine On RewriteCond %{HTTP_USER_AGENT} (googlebot|bingbot|Baiduspider) [NC] RewriteRule .* - [R=403,L]
     
  5. AAWebDev

    AAWebDev Jr. VIP Jr. VIP Premium Member

    Joined:
    May 20, 2012
    Messages:
    674
    Likes Received:
    63
    Occupation:
    Forum Developer
    Location:
    Dexel Island
    Home Page:
    if u want to block google only, put only googlebot here ^^
     
  6. SmartMan

    SmartMan BANNED BANNED

    Joined:
    Jul 25, 2012
    Messages:
    673
    Likes Received:
    1,244
    Wow too many copy pasters on the block who doesn't have a clue.

    OP, following code should block the google from accessing the /go/ folder. It'll show

    Code:
    # block google
    
    RewriteEngine On
    
    RewriteCond %{HTTP_USER_AGENT}   ^googlebot
    RewriteRule ^/go/ - [F,L]
    
    Note: You should place the .htaccess in the parent directory not in the /go/ directory.

    HTH
     
    • Thanks Thanks x 2
  7. tabish8612

    tabish8612 Power Member

    Joined:
    Sep 13, 2009
    Messages:
    504
    Likes Received:
    109
    Occupation:
    Online Marketing
    Location:
    In your home...COMPUTER
    SmartMan: Do I need to paste this code below </IfModule>?
     
  8. SmartMan

    SmartMan BANNED BANNED

    Joined:
    Jul 25, 2012
    Messages:
    673
    Likes Received:
    1,244
    If there's already a rule mentioned within the </IfModule> , you can put the code inside it If not, you can paste the following code.

    Code:
    <IfModule mod_rewrite.c>
    
    
    # block google
    
    
    RewriteEngine On
    
    
    RewriteCond %{HTTP_USER_AGENT}   ^googlebot
    RewriteRule ^/go/ - [F,L]
    
    </IfModule>
    
     
  9. dinkish

    dinkish Power Member

    Joined:
    Apr 19, 2013
    Messages:
    689
    Likes Received:
    159
    You mentioned put it on the main directory. If a domain was hosted from that go folder, would you need to put an additional .htaccess rule in /go to prevent further indexing?
     
  10. SmartMan

    SmartMan BANNED BANNED

    Joined:
    Jul 25, 2012
    Messages:
    673
    Likes Received:
    1,244
    There's only 2 possibilities to host a domain on that folder.

    1. If you add the domain as an add-on domain where the cPanel will create it for you.

    2. If you setup a custom sub-domain on the same directory.

    If that's the case, It's better to have a separate .htaccess within that folder with the following code.

    Code:
    <IfModule mod_rewrite.c>
    
    # block google
    
    RewriteEngine On
    
    RewriteCond %{HTTP_USER_AGENT}   ^googlebot
    RewriteRule .* - [F,L]
    
    </IfModule>
    
     
  11. tabish8612

    tabish8612 Power Member

    Joined:
    Sep 13, 2009
    Messages:
    504
    Likes Received:
    109
    Occupation:
    Online Marketing
    Location:
    In your home...COMPUTER
    smartman: when it comes to htaccess file I have not much experience. I have addon domain and this code is written:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

    Can you tell where to put code? thanks
     
  12. SmartMan

    SmartMan BANNED BANNED

    Joined:
    Jul 25, 2012
    Messages:
    673
    Likes Received:
    1,244
    Edit the .htaccess & Replace it with the following code.

    Code:
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    
    
    # block google
    
    
    RewriteEngine On
    
    
    RewriteCond %{HTTP_USER_AGENT}   ^googlebot
    RewriteRule .* - [F]
    
    
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    
    # END WordPress
    
     
    • Thanks Thanks x 1