【发布时间】:2016-11-02 23:03:41
【问题描述】:
我一直试图阻止所有试图查看 .php 页面而不来自我的特定跟踪链接的人的访问。
如果他们不是来自我的链接,我希望他们被重定向到另一个网站。 我尝试使用 .htaccess 方法如下:
RewriteEngine On
RewriteBase /
# allow these referers to passthrough
RewriteCond %{HTTP_REFERER} ^http://subdomain.domain.com
RewriteRule ^ - [L]
# redirect everything else
RewriteRule ^ http://anotherDomain.com/ [R,L]
这是因为http://subdomain.domain.com 是一个重定向到 website.php 的跟踪 URL,但它似乎不起作用,尽管有任何引荐来源,甚至直接在工具栏中输入 website.php 的 URL 都会将用户带到网站.php。
我想要实现的是只有从 subdomain.domain.com 用户才能看到 website.php
提前致谢。
【问题讨论】:
标签: apache .htaccess url-redirection referrer http-referer