mod_rewrite 将所有流量从特定域重定向到特定页面
我希望所有带有 REFERER“bad-domain.com”的流量都转到名为 Hole 的特定页面。它似乎在 .htaccess 中根本不起作用,所以我将它放在服务器配置中。它是一个 wp,所有其余的重写内容都在 .htaccess 中——这是非常典型的 wp 重写。
我遇到了各种各样的问题,一旦我遇到了重定向循环,一旦我得到了 400。当前的配置会公开整个站点的根目录结构,如果引荐来源网址是坏域,我们不能这样做,所以我暂时对其进行了评论。
我想我明白一切,我知道我非常接近答案,但我不知道如何让它完全按照我想要的方式做,而不是我不想要的。
如果 .htaccess 符合这些条件,它似乎会忽略它。它不是先做 serverconfig 的东西,然后再做 htaccess 的东西吗?
这是服务器配置中的三行
RewriteCond %{HTTP_REFERER} .*xxxxxx.com.* [NC]
RewriteCond %{REQUEST_URI} !(/)$
RewriteRule ^.*$ /hole/
I want all traffic with REFERER "bad-domain.com" to go to a specific page named hole. It doesn't seem to work at all in .htaccess so I put it in the server config. It is a wp and all the rest of the rewrite stuff is in .htaccess -- it is pretty typical wp rewrites.
I have had various problems, once I got a redirect loop, and once I got a 400. The current configuration exposes the entire site's root directory structure if the referer is bad-domain we can't have that so I momentarily commented it.
I think I understand everything and I know I'm very close to the answer but I don't know how to make it do exactly what I want and nothing that I don't want.
It seems like it is ignoring the .htaccess stuff if it matches these conditions. doesn't it do serverconfig stuff first and THEN do htaccess stuff?
This is the three lines in the server config
RewriteCond %{HTTP_REFERER} .*xxxxxx.com.* [NC]
RewriteCond %{REQUEST_URI} !(/)$
RewriteRule ^.*$ /hole/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论