本文介绍了阻止大家,除了来自特定引荐游客的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在htaccess的,我怎么能阻止每一位参观者,包括机器人,除了那些谁来自一个特定的域或与特定用户代理?
In htaccess, how can i block every visitor, including bots, except those who come from a specific domain or with a specific user agent?
我必须保护每一页的访问,除了几个允许访问的网页的。
I must protect every page from access, except couple of allowed pages.
大家谁是阻止应该接收自定义通知。
everyone who is blocked should receive a custom notice.
感谢
推荐答案
首先,请允许公共页面,包括禁止消息。然后允许与适当的 的RewriteCond
S和发送状态 403
来一切
First allow public pages including the forbidden message. Then allow requests with specific referrer and user agents with the appropriate RewriteCond
s and send a status 403
to everything else
RewriteEngine on
# allow public pages
RewriteRule ^forbidden.html$ - [L]
RewriteRule ^public1.html$ - [L]
RewriteRule ^public2.html$ - [L]
# serve everyone from specific-domain or specific-user-agent
RewriteCond %{HTTP_REFERER} ^https?://www.specific-domain.com [OR]
RewriteCond %{HTTP_USER_AGENT} ^specific-user-agent$
RewriteRule ^ - [L]
# everybody else receives a forbidden
RewriteRule ^ - [F]
ErrorDocument 403 /forbidden.html
这篇关于阻止大家,除了来自特定引荐游客的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!