Answer the question
In order to leave comments, you need to log in
How to register a referrer ban in .htaccess?
Good afternoon!
The situation is this. There is a WordPress site in which a ban on certain referrers is registered in the root .htaccess file:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_REFERER} ok.ru [NC,OR]
RewriteCond %{HTTP_REFERER} mamba.ru [NC,OR]
RewriteCond %{HTTP_REFERER} facebook.com [NC]
RewriteRule .? - [F,L]
Everything works, but, on the site, due to the need, two separate WordPress cms are installed, one in the root of the site, where the above construction is written, the other cms in the /doma/ folder. AddDefaultCharset UTF-8
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /doma/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /doma/index.php [L]
</IfModule>
# END WordPress
With all this, referrer restrictions do not work for the /doma/ folder and all site pages from this directory. Answer the question
In order to leave comments, you need to log in
FILE /doma/.htaccess
AddDefaultCharset UTF-8
RewriteEngine On
RewriteCond %{HTTP_REFERER} ok\.ru [NC,OR]
RewriteCond %{HTTP_REFERER} mamba\.ru [NC,OR]
RewriteCond %{HTTP_REFERER} facebook\.com [NC]
RewriteRule ^ - [F]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /doma/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /doma/index.php [L]
</IfModule>
# END WordPress
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question