开发者

htaccess maintenance page redirect results in "too many redirects" error

This is my code: why doe开发者_运维知识库s 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]


I think you should remove ^ from request_uri


Assuming this is the same domain, you're redirecting everything to /i/page.html except /page.html. Strip out /i/page.html instead.


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]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜