我正在尝试进行 .htaccess 重定向,它可以执行以下操作:
- 将页面 A 重定向到页面 B;
- 重定向除我的 IP 之外的所有流量。
你能帮我吗?
最佳答案
重定向到哪里
错误文档 403 [重定向到何处]
命令拒绝、允许
阻止所有人
所有人都否认
除了...
允许来自 [YourIPGoesHere]
完整代码示例:
ErrorDocument 403 http://www.google.com/
order deny,allow
deny from all
allow from 173.194.41.134
编辑:
您也可以尝试这个:
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} !^173\.194\.41\.134
RewriteCond %{REQUEST_URI} !/somethingHere\.html$
RewriteRule .* /somethingHere.html [R=302,L]
关于.htaccess - htaccess 页面重定向(除了我的 ip),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10278730/