开发者

htaccess stop processing rules

开发者 https://www.devze.com 2023-03-23 11:27 出处:网络
I need to be able to run the rule开发者_运维知识库s at CakePHP block if my IP matches the Maintenance Mode conditions otherwise ignore them, possible? Thanks.

I need to be able to run the rule开发者_运维知识库s at CakePHP block if my IP matches the Maintenance Mode conditions otherwise ignore them, possible? Thanks.

RewriteEngine on

# Maintenance Mode
RewriteCond %{REQUEST_URI} !/offline\.php$
RewriteCond %{REMOTE_ADDR} !^(00\.00\.00\.00)
RewriteRule .* /offline\.php [L]

# CakePHP
RewriteRule    ^$ app/webroot/    [L]
RewriteRule    (.*) app/webroot/$1 [L]


Yes, that is possible:

RewriteEngine on

# Maintenance Mode
RewriteRule ^offline\.php$ - [L]
RewriteCond %{REQUEST_URI} !^/offline\.php$
RewriteCond %{REMOTE_ADDR} !=192.168.0.2
RewriteRule .* /offline.php [L]

# CakePHP
RewriteRule ^$ app/webroot/ [L]
RewriteCond %{REQUEST_URI} !^/app/webroot/
RewriteRule (.*) app/webroot/$1 [L]
  1. Use your own IP address

  2. I have added condition to the very last rule to prevent rewrite loop

0

精彩评论

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