安装laravel5时,public中的.htaccess文件不起作用。


使用composer下载好laravel后,配置apache,mod_rewrite模块已打开,AllowOverride None也改成了All。在进行到用浏览器打开localhost之后并没有出现欢迎界面,而是public中的三个文件列表。
图片描述

但是教程中所写的是:“Laravel 框架通过 public/.htaccess 文件来让网址中不需要 index.php”。

给出的解决方案:
Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

加进/覆盖原public下的.htaccess文件也是不可行。

其他信息:apache2.4.12/php 5.4.42/laravel5/winxp X86

请问如何解决?
多谢!

php laravel-5

我只是一个宅 9 years, 1 month ago

百度到一条相关信息是说apache的rewrite模块没有被正确加载.
楼主可以做一下测试, 不使用lavarel,
就是写一条简单的规则测试rewrite是否工作正常, 然后再看别的配置问题.
RewriteRule ^ index.php [L]
这句的意思是任何前缀都直接跳转到index.php. 应该是没写错吧.

yuio054 answered 9 years, 1 month ago

改完配置是否重启APACHE了?

躺着也中槍 answered 9 years, 1 month ago

Your Answer