虚拟主机与重写规则和别名的Apache不工作

问题描述 投票:0回答:1

<VirtualHost *:80>
 ServerName abc.example.com
 ServerAlias abc.example.com
 DocumentRoot /var/www/html/abc

 RewriteEngine On
    # If an existing asset or directory is requested go to it as it is
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
    RewriteCond %{REQUEST_URI} !^/adl/$
    RewriteRule ^ - [L]
    # If the requested resource doesn't exist, use index.html
    RewriteRule ^ /index.html
</VirtualHost>

alias /adl /opt/dl

我有一个虚拟主机设置类似这样和它完美的罚款。现在我想,如果有在重写规则不应该适用的路径/ ADL和我有一个别名,它指向的路径在我的机器的目录结构。

apache virtualhost
1个回答
0
投票

我有固定它像下面的方式

<VirtualHost *:80>
 ServerName walton2.biz-motion.com
 ServerAlias walton2.biz-motion.com
 DocumentRoot /var/www/html/fmcg

 RewriteEngine On
 RewriteRule ^/?(adl)($|/) - [L]    
 RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
 RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
 RewriteRule ^ - [L]
 RewriteRule ^ /index.html
</VirtualHost>

发布它,因为如果有人面对这个。

© www.soinside.com 2019 - 2024. All rights reserved.