使用HTTPD.conf从根重定向到特定URI

问题描述:

当维护文件就位时,第一条规则正常工作。当它不是 - 第二条规则不是重定向到特定的URI。是否有规则的订购问题?使用HTTPD.conf从根重定向到特定URI

######################################### 

    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] 

    ######################################### 

你不会在重写规则匹配的主机名,即使如此有更多的理由,如果你已经在先前定义的RewriteCond匹配它。

所以只是做:

RewriteCond %{HTTP_HOST} ^host\.server\.org$ [NC] 
RewriteRule^https://host.server.org/lawson/portal [L] 

注:重写规则目标/目的不regix所以不需要逃避每一件小事。

注2:单^将匹配使用这种方法的任何

+0

- 我收到了以下问题:您没有权限访问/在此服务器上。 Options指令禁止的目录索引:/ lsf10/webdocs/ – Configueroa

+0

如果您没有索引或目录索引集,您希望apache如何为目录提供服务? –