mod_rewrite规则来检查维护页面,除了某些子域

时间:2021-09-08 11:20:03

I have configured Apache to look for the presence of a maintenance page and redirect to that page if it is present:

我已经配置好Apache来查找维护页面的存在,如果存在,则重定向到该页面:

RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.
RewriteRule ^.*$ /system/maintenance.html [L]

This is fairly standard practice for deploying Ruby on Rails apps.

这是部署Ruby on Rails应用程序的标准实践。

What I'd like to do to create a URL exclusion list so the redirect doesn't occur for specific subdomains, e.g: https://user1.myapp.com/any_request_url or https://user2.myapp.com/any_request_url

我想做的是创建一个URL排除列表,这样就不会发生针对特定子域的重定向。g:https://user1.myapp.com/any_request_url或https://user2.myapp.com/any_request_url

Can this be achieved with extra RewriteCond statements?

这能通过额外的重写来实现吗?

1 个解决方案

#1


4  

This should do it:

这应该这样做:

RewriteCond %{HTTP_HOST} !^(user1|user2)\.myapp\.com$

#1


4  

This should do it:

这应该这样做:

RewriteCond %{HTTP_HOST} !^(user1|user2)\.myapp\.com$