So I am blocking all ip's except the ones on a list, so how can I redirect people to a new site if they're blocked?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
My assumption is that you are blocking ip's using allow/deny. I do not believe that you are able to specify a redirect rule to work on the denied ip's as you have told the server to reject their connections outright.
Instead you are going to want to use the RewriteEngine to do a redirect. In case you are unfamiliar with the syntax I have provided the following example which will redirect all ip's except for "72.14.204.99" and "72.14.204.100" to "example.org":
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^72\.14\.204\.99$
RewriteCond %{REMOTE_ADDR} !^72\.14\.204\.100$
RewriteRule ^ http://www.example.org/ [R]