开发者

mod_rewrite redirect all traffic from a specific domain to a particular page

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 nothi开发者_运维技巧ng 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/  
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜