我正在尝试添加一个htaccess规则,该规则将执行以下操作。
允许特定IP
允许从特定引用(另一个域)
拒绝其他所有
拒绝重定向到特定URL。(另一个域)
这是一个wordpress网站a和使用htaccess的想法,除非有其他方法。谢谢你提前提供的帮助。
您可以使用:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_REFERER} !^http://www.your_domain.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.another_domain.com/ [NC]
RewriteRule ^.*$ http://www.another_domain.com/not_allowed_here.htm [R=301,L]
ErrorDocument 403 http://www.another_domain.com/specific_page.html
order deny,allow
deny from all
allow from 111.222.333.444
与用户在同一测试中:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_REFERER} !^http://www.your_domain.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.another_domain.com/ [NC]
RewriteCond %{REMOTE_ADDR} !^111.222.333.444$
RewriteRule ^.*$ http://www.another_domain.com/not_allowed_here.htm [R=301,L]