我如何使用的.htaccess到特定IP地址的访问者转发到我的网页服务器上?
How can I use .htaccess to forward a visitor of a specific IP address to a webpage on my server?
这个例子会导致一个无限循环:
This example causes an infinite loop:
RewriteCond %{REMOTE_ADDR} ^123.123.123.123$
RewriteRule ^(.*)$ /specialpage.php [R,L]
我发现这个在网络上,但它只是不工作:
I found this on the web but it just does not work:
SetEnvIf REMOTE_ADDR 123.123.123.123 REDIR="redir"
RewriteCond %{REDIR} redir
RewriteRule ^(.*)$ /specialpage.php
注:我的网站包含的.htm,html和.PHP页
Note: My website consists of .htm, html and .php pages.
您的帮助将是非常美联社preciated。
Your help would be very much appreciated.
添加一个条件的没有的重写,当你已经在specialpage:
Add a condition to not rewrite when you're already at specialpage:
RewriteCond %{REMOTE_ADDR} ^123.123.123.123$
RewriteCond %{REQUEST_URI} !/specialpage.php
RewriteRule ^(.*)$ /specialpage.php [R,L]