Arch-Linux上的Apache有问题。 我认为这是相关的mod_rewrite,但我不知道。
过去我一直使用基于Debian的系统。 拱似乎有点不同。
我有一个这样的虚拟主机,并在各自的目录index.php。 我尝试了和没有.htaccess。
<VirtualHost *:80> ServerName test.localhost DocumentRoot /home/me/sites/test <Directory /home/me/sites/test> Options FollowSymLinks AllowOverride All </Directory> </VirtualHost>
当我访问http://test.localhost/或http://test.localhost/index.php ,它工作正常。
当我访问http://test.localhost/foo ,它找不到404。
我可以用ErrorDocument 404 /index.php添加一个.htaccess,所以Apache会打开index.php并正确的遵循.htaccess的mod_rewrite指令,但是它仍然有404头文件。
任何想法要寻找什么?
原来,mod_rewrite没有启用。
在/etc/httpd/conf/httpd.conf ,取消注释:
#LoadModule rewrite_module modules/mod_rewrite.so
为什么我一开始没有find? 因为所有的url重写似乎工作正常,除了404头。