![](/img/trans.png)
[英]Laravel redirecting to index.php laravel 5.6 due to wrong htaccess
[英]Laravel 5 - .htaccess (index.php)
因此,我被要求部署由其他开发人员完成的即用型laravel项目。 它使用laravel 5,并在IIS管理器中设置。
现在,我们正在对网站进行一些功能升级,我想在本地主机上运行该网站。 我正在使用XAMPP。
我已经从实时Web服务器复制了整个文件夹,并完美地完成了数据库配置。
现在,我可以毫无问题地查看主页了。
仅供参考,文件夹结构是这样的
C:/xampp/htdocs/myproject/
-app
-aspnet_client
-bootstrap
-config
-css
-database
-images
-js
-logs
-resources
-storage
-tests
-touchtouch
-vendor
.htaccess
index.php
package.json
server.php
...
现在,我可以运行“ localhost / myproject”并完美加载主页,但是当我运行此链接(例如localhost / myproject / aboutus)时,它说
Sorry, the page you are looking for could not be found.
NotFoundHttpException in RouteCollection.php line 145:
而如果我运行此localhost / index.php / aboutus,它将完美加载。
我的htaccess是:
php_flag xcache.cacher 0
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /MyProject/
# Redirect Trailing Slashes...
RewriteRule ^(.*)$index.php /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
如果这很重要,我的config / app.php网址是“ http:// localhost ”。
并且我已经打开了LoadModule rewrite_module modules / mod_rewrite.so
我错过了什么吗? 谢谢您的帮助。
我已经解决了。 问题出在RewriteBase上; 我的真实文件夹是MyProject,我只是将其重命名为所有小写字母,现在它就像魅力一样工作。
我更改了.htaccess
php_flag xcache.cacher 0
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteBase /myproject/
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$/$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.