![Apache2 - 将子目录作为根目录,但现在子目录中的其他站点已损坏](https://linux22.com/image/788532/Apache2%20-%20%E5%B0%86%E5%AD%90%E7%9B%AE%E5%BD%95%E4%BD%9C%E4%B8%BA%E6%A0%B9%E7%9B%AE%E5%BD%95%EF%BC%8C%E4%BD%86%E7%8E%B0%E5%9C%A8%E5%AD%90%E7%9B%AE%E5%BD%95%E4%B8%AD%E7%9A%84%E5%85%B6%E4%BB%96%E7%AB%99%E7%82%B9%E5%B7%B2%E6%8D%9F%E5%9D%8F.png)
所以我在我的网络服务器上安装了一个新工具,它有一个有点复杂的文件夹结构,为了使它运行,我将所有内容放在一个子目录中,并将其作为我的域的根目录。
相应的 .conf
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/html/example/public
<Directory /var/www/html/example/public>
AllowOverride All
# Apache 2.2
Order Allow,Deny
Allow from All
# Apache 2.4
# Require all granted
FallbackResource /index.php
</Directory>
RewriteEngine on
RewriteCond %{SERVER_NAME} =example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
但是现在其他之前运行良好的网站却出现 404 错误(该错误信息来自新托管的网站。
因此,通过 http(s)://example.com/example2 请求的 /var/www/html/example2 不再显示。
我首先承认我不太了解 Apache 配置,但一定有办法解决这个问题,任何帮助都将不胜感激。