• So far I have this but everything I try doesn’t stop me visiting my site from the link on the bad site. I managed to get a 403 for links to our homepage because its HTML but the rest of the site is WordPress and I can’t get a 403 to show for the inner pages of our site 🙁

    AddType text/x-component .htc
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    # Options +FollowSymlinks
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    RewriteEngine on
    # Options +FollowSymlinks
    RewriteCond %{HTTP_REFERER} http://www.BADSite.com [NC]
    RewriteRule .* – [F]
    </IfModule>
    # END WordPress

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Try putting these two lines on top instead.

    RewriteCond %{HTTP_REFERER} http://www.BADSite.com [NC]
    RewriteRule .* - [F]
    Thread Starter Loco77

    (@richieb799)

    Where on top Jan? Do you mean above:

    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Yep, on the very first line of that file. Wrap it in <IfModule mod_rewrite.c> just to be safe.

    <IfModule mod_rewrite.c>
    RewriteCond %{HTTP_REFERER} http://www.BADSite.com [NC]
    RewriteRule .* - [F]
    </IfModule>
    Thread Starter Loco77

    (@richieb799)

    Your a genius Jan!!!!! It works, its taken me 2 days to figure this!

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    You’re welcome, glad to help. 🙂

    Thread Starter Loco77

    (@richieb799)

    Hi Jan, I’m back, everything was going fine and the blocks were working for all of the badlinks we didn’t want pointing to us.
    You could visit the inner pages by typing them in the address bar and the 403 didn’t display.
    Then my client noticed that clicking on the links in Google also resulted in the 403? Do you know why this might be happening?

    AddType text/x-component .htc
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    # Options +FollowSymlinks
    RewriteEngine On
    </IfModule>
    <IfModule mod_rewrite.c>
    RewriteCond %{HTTP_REFERER}http://www.BADLINKS.com [NC]
    RewriteRule .* – [F]
    </IfModule>
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Can't Block Referrer in htaccess’ is closed to new replies.