htaccess干净的URL不被读取的Apache?

我在这里变得有点疯狂,因为我已经浪费了两个小时让我的干净的网站启用laravel框架。

我在Mac上,并有一个XAMPP设置。 Loadmodule mod_rewrite被注释掉了,php_info()表示mod_rewrite模块被加载了。

我的.htaccess文件在laravel框架的公共文件夹中包含清理URL的代码(正如他们的网站所述),但是当我浏览到domain.com/account时,它给了我一个404。

laravel框架文件夹作为虚拟主机运行。

这是怎么回事,那是错的?!

<IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] </IfModule> 

确保Loadmodule mod_rewrite未被注释。

确保你有适当的AllowOverride设置的虚拟主机允许.htaccess做它的事情。

良好指令的一个例子是:

 <Directory "/some/absolute/path/htdocs"> Options Indexes Includes FollowSymLinks MultiViews AllowOverride AuthConfig FileInfo Order allow,deny Allow from all </Directory> 

遵循.htaccess所要做的是:

 <Ifmodulee mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L] </Ifmodulee> 

非常接近你在做什么。

重新启动你的Apache服务器。