htaccess的清洁网址不是由Apache的阅读? [英] htaccess for clean urls not being read by apache?
问题描述
我越来越有点疯狂这里是因为我已经浪费了两个小时来往启用了laravel框架,我的干净的URL。
我是Mac,并且有一个XAMPP设置。在加载模块的mod_rewrite被注释掉和php_info()说的mod_rewrite模块加载。
在laravel框架的公共文件夹我的.htaccess文件包含code为次清洗的网址(如在其网站上说),但仍,当我浏览到domain.com/account~~V它给了我一个404
该laravel框架文件夹运行作为一个虚拟主机。
这莫非,这是怎么了?!
< IfModule mod_rewrite.c>
RewriteEngine叙述上
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则^(。*)$的index.php / $ 1 [L]
< / IfModule>
确认加载模块的mod_rewrite
是注释。
请确保您有设置AllowOverride设置合适的虚拟主机为允许.htaccess做的事情。
一个好的指令的一个例子是:
<目录/一些/绝对/路径/ htdocs目录>
选择指标包括了FollowSymLinks多视图
的AllowOverride项AuthConfig的FileInfo
订购允许,拒绝
所有允许
< /目录>
一个很好的图案,以遵循的.htaccess为您所试图做的是:
< IfModule mod_rewrite.c>
RewriteEngine叙述上
的RewriteBase /
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则^(。*)$的index.php?/ $ 1 [L]
< / IfModule>
非常接近你在做什么。
重新启动Apache服务器。
I'm getting kinda crazy over here because I already wasted two hours getting my clean urls enabled for the laravel framework.
I'm on a Mac and have a XAMPP setup. The Loadmodule mod_rewrite is commented out and php_info() says mod_rewrite module is loaded.
My .htaccess file in the public folder of the laravel framework contains the code for cleans urls (as stated on their website) but still, when I surf to domain.com/account it gives me an 404.
The laravel framework folder runs as an virtual host.
What could it be, that is going wrong?!
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
Make sure Loadmodule mod_rewrite
is uncommented.
Make sure you have AllowOverride set appropriately for the vhost to allow .htaccess to do its thing.
One example of a good directive is:
<Directory "/some/absolute/path/htdocs">
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all
</Directory>
A good patter to follow for .htaccess for what you are trying to do is:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
Very close to what you are doing.
Restart your apache server.
这篇关于htaccess的清洁网址不是由Apache的阅读?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!