我有一个。htaccess设置权限777与一个简单的规则:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
在/etc/apache2/apache2.conf中,我删除了所有的命令,除了一个简化的:
<Directory />
AllowOverride All
</Directory>
在/etc/apache2/sites-enabled/000-default.conf中,我添加了:
<Directory /var/www/html>
AllowOverride All
Options -Indexes +FollowSymLinks +MultiViews
Order allow,deny
Allow from all
</Directory>
我已经"sudo service apache2 restart" (Ubuntu 14.04)
但无论出于何种原因,我无法将对http://www.myserver.com/blah/blah的调用路由到index.php
感觉.htaccess被忽略了或者重写规则没有运行。
我不知道去哪里看,我已经跟随了其他SO帖子,没有运气。什么好主意吗?
请确保您已打开重写模块。
sudo a2enmod rewrite
sudo service apache2 restart
因为你有if检查模块,这意味着不会有任何错误,如果它不启用