Apache 2.4,Windows 10
httpd-vhosts.conf中的虚拟主机:
<VirtualHost sporemvc:80>
ServerAdmin jakub.sawczuk@gmail.com
DocumentRoot "C:/Apache24vhosts/hosts/sporemvc"
ServerName sporemvc
ErrorLog "logs/sporemvc-error.log"
CustomLog "logs/sporemvc-access.log" common
<Directory C:/Apache24vhosts/hosts/sporemvc>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php [L]
</Directory>
</VirtualHost>
这很好用。并且证明mod_rewrite已经开启。
当整个目录不存在时:
<VirtualHost sporemvc:80>
ServerAdmin jakub.sawczuk@gmail.com
DocumentRoot "C:/Apache24vhosts/hosts/sporemvc"
ServerName sporemvc
ErrorLog "logs/sporemvc-error.log"
CustomLog "logs/sporemvc-access.log" common
</VirtualHost>
并且有C:/Apache24vhosts/hosts/sporemvc/.htaccess文件
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]
重写规则似乎根本不起作用--Apache说404.可能有什么问题?我确保mod_rewrite打开,甚至.htaccess是ANSI而不是UTF。在Apache和vhost的日志中,只有404个。
我做错了什么?
答案 0 :(得分:0)
是的,我很笨。
AllowOverride
无法更改为AllowOverride All
(嗯,All
可以进行开发)。
Causa finita。