htaccess维护页面重定向会导致“太多重定向”,导致错误
问题描述:
这是我的代码:为什么以无限循环结尾? (这个想法是转发除1外的所有IP)。
This is my code: why does this end in a infinite loop? (the idea was to forward all IP's except 1).
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !=91.198.106.118
RewriteCond %{REQUEST_URI} !^/page\.html$
RewriteRule ^(.*)$ http://domain.nl/i/page.html [R=307,L]
答
将此代码放入您的.htaccess:
Put this code in your .htaccess:
Options -MultiViews +FollowSymLinks
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !=91.198.106.118
RewriteRule ^(?!i/page\.html).*$ http://domain.nl/i/page.html [R=307,L,NC]