Home  >  Article  >  Backend Development  >  安装laravel5时,public中的.htaccess文件不起作用。

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

WBOY
WBOYOriginal
2016-06-06 20:33:131291browse

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

但是教程中所写的是:“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

请问如何解决?
多谢!

回复内容:

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

但是教程中所写的是:“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

请问如何解决?
多谢!

改完配置是否重启APACHE了?

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn