开发者

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

开发者 https://www.devze.com 2023-03-13 17:14 出处:网络
This is my code: why doe开发者_运维知识库s this end in a infinite loop? (the idea was to forward all IP\'s except 1).

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

精彩评论

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

关注公众号