如何从我的网站重定向除我之外的所有人?

时间:2014-06-18 20:00:52

标签: .htaccess mod-rewrite

基本上,我想知道的是这个问题的标题:

RewriteBase /

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} !^11.11.11.111
RewriteCond %{REQUEST_URI} !/www.mywebsite.site10.net/Stuff/randomfile.html\.html$ 
RewriteRule .* http://www.google.com [R=302,L]

11.11.11.111是我的IP地址

1 个答案:

答案 0 :(得分:1)

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_HOST} !^xxx\.xxx\.xxx\.xxx
RewriteRule \.html$ /anotherPage.html [R=302,L]

其中xxx.xxx.xxx.xxx是你的ip,而anotherPage.html是重定向页面。

这是302移动的临时重定向http://en.wikipedia.org/wiki/HTTP_302