[英]apache - my .htaccess doesn't work only for 1 sub-domain and work for other
我正在使用Ubuntu wizzy作为我的本地服务器,然后我在那里设置域名
这就是问题所在。 我为所有这些创建完全相同的配置,但为什么只有adm.domain.svr不起作用? 当我访问http://adm.domain.svr/site/dashboard/
时,它总是响应404但是当我尝试http://api.domain.svr/site/dashboard/
时它没关系
这是我的配置
<VirtualHost *:80>
ServerAdmin localhost@gmail.com
ServerName domain.svr
DocumentRoot /home/shaf/web/domain.dev/frontend/web
<Directory />
Options FollowSymLinks
AllowOverride all
</Directory>
<Directory /home/shaf/web/domain.dev/frontend/web>
Require all granted
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
ErrorLog /home/shaf/log/domain-error.log
LogLevel warn
CustomLog /home/shaf/log/domain-access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin localhost@gmail.com
ServerName adm.domain.svr
DocumentRoot /home/shaf/web/domain.dev/backend/web
<Directory /home/shaf/web/domain.dev/backend/web>
Require all granted
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
ErrorLog /home/shaf/log/domain-adm-error.log
LogLevel warn
CustomLog /home/shaf/log/domain-adm-access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin localhost@gmail.com
ServerName api.domain.svr
DocumentRoot /home/shaf/web/domain.dev/api/web
<Directory />
Options FollowSymLinks
AllowOverride all
</Directory>
<Directory /home/shaf/web/domain.dev/api/web>
Require all granted
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
ErrorLog /home/shaf/log/domain-api-error.log
LogLevel warn
CustomLog /home/shaf/log/domain-api-access.log combined
</VirtualHost>
这是我放在每个域名web文件夹中的.htaccess
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
请给我关于此的建议,我真的不知道。
您的ServerName domain.svr是错误的。 Apache无法路由它。 尝试将其重命名为adm.domain.svr
我只是通过复制另一个目录来解决这个问题并尝试但是失败了,所以我创建另外一个主机,所以我有4个主机。 1是adm的重复,它的工作完美。 我仍然不知道发生了什么,但似乎只有那个文件夹没有读取htaccess而且我很确定它因为我已经尝试交换子域但只有adm文件夹不能读取htaccess文件。
所以这是我的结论,我不知道这是否正确,但apache有缓存的htaccess,所以我需要硬刷新apache(只有重启apache不起作用,因为我已经尝试了几次,没有任何事情发生)所以也许你需要重启你的操作系统/服务器,如果你不想要它,试试我的方式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.