仅针对具体的IP:
我使用.htaccess将所有网址发送到/
我想添加另一个RewriteCone从“test.txt”移动到“some.php”
htaccess文件:
RewriteCond %{HTTP_HOST} ^site.com$ [NC]
RewriteRule ^(.*)$ http://www.site.com/$1 [L,R=301]
RewriteCond %{REMOTE_ADDR} ^45\.96\.33\.55$
RewriteCond %{REQUEST_URI} !^/$
RewriteCond %{REQUEST_URI} !^/(test\.txt|some\.php)$ [NC]
RewriteRule ^ / [R=301,L]
RewriteCond %{REMOTE_HOST} ^45\.96\.33\.55$
RewriteCond %{REQUEST_URI} =/test.txt
RewriteRule ^(.*)$ /some.php [L,R=301]
我的规则好吗?
更新
我可以为这样的规则添加更多的ip吗?
RewriteCond %{REMOTE_ADDR} ^45\.96\.33\.55$
RewriteCond %{REMOTE_ADDR} ^33\.33\.55\.66$
RewriteCond %{REQUEST_URI} !^/$
RewriteCond %{REQUEST_URI} !^/(test\.txt|some\.php)$ [NC]
RewriteRule ^ / [R=301,L]
RewriteCond %{REMOTE_HOST} ^45\.96\.33\.55$
RewriteCond %{REMOTE_ADDR} ^33\.33\.55\.66$
RewriteCond %{REQUEST_URI} =/test.txt
RewriteRule ^(.*)$ /some.php [L,R=301]