htaccess的阻止所有IP的,如果它们被阻止重定向到一个页 [英] .htaccess block all ip's, if they are blocked redirect to a page

查看:87
本文介绍了htaccess的阻止所有IP的,如果它们被阻止重定向到一个页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我阻止所有IP的除了那些名单上,所以我怎么能重定向人到一个新的网站,如果他们阻止?

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?

推荐答案

我的假设是,你是封锁IP的使用允许/拒绝。我不相信,你可以指定一个重定向规则工作,对被拒绝的IP的,你告诉服务器拒绝它们的连接顾左右而言他。

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.

相反,你会想用RewriteEngine叙述做一个重定向。如果你不熟悉我提供了下面的例子将重定向所有IP的除了72.14.204.99和72.14.204.100到example.org的语法:

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]

这篇关于htaccess的阻止所有IP的,如果它们被阻止重定向到一个页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆