The first rule works fine when the maintenance file is in place. When it's not - the second rule is not redirecting to the specific URI. Is there an ordering issue of rules or ?
#########################################
RewriteCond %{DOCUMENT_ROOT}/server_maintenance.html -f
RewriteCond %{REQUEST_FILENAME} !/server_maintenance.html
RewriteRule ^.*$ /server_maintenance.html [L]
#########################################
## the %{HTTP_HOST} evaluates to the HTTP header with the name given in this case host.server.org, with NC being non case sensitive.
## it will rewrite the url at the server side to append the URI of lawson/portal
##########################################################################
RewriteCond %{HTTP_HOST} ^host\.server\.org$ [NC]
RewriteRule ^host\.server\.org$ "https\:\/\/host\.server\.org\/lawson\/portal" [L]
#########################################
答案 0 :(得分:0)
您不会在RewriteRule中匹配主机名,即使如此,如果您已经在先前定义的RewriteCond中匹配它,还有更多理由。
所以就这样做:
RewriteCond %{HTTP_HOST} ^host\.server\.org$ [NC]
RewriteRule ^ https://host.server.org/lawson/portal [L]
注意:RewriteRule目标/目标不是regix所以不需要逃避每一件小事。
注2:单个^将匹配任何内容