[英]Laravel 5.3 route not working
I have installed fresh copy of laravel 5.3. 我已经安装了laravel 5.3的新副本。
I have the following code in my route/web.php
. 我的
route/web.php
有以下代码。
Route::get('/', function () {
return view('welcome');
});
Route::get('welcome', function () {
return view('welcome');
});
when i hit localhost/project/public
in the browser i can see laravel welcome page. 当我在浏览器中点击
localhost/project/public
时,我可以看到laravel欢迎页面。
But when i hit localhost/project/public/welcome
then 404 Not Found
comes up where i should get the same laravel welcome page. 但是,当我点击
localhost/project/public/welcome
404 Not Found
,我应该获得相同的laravel欢迎页面。
Am i forgetting something ? 我忘记了什么吗?
Laravel不区分大小写,因此如果使用其中之一创建项目,将找不到路径。
I was having some trouble with this myself, so for anyone having trouble with getting a Laravel route to work: 我自己对此有一些麻烦,因此对于任何在Laravel上班路上遇到麻烦的人来说:
php artisan route:list
Your route should show up, along with the method. php artisan route:list
确保您的路由定义正确,该路由应与方法一起显示。 (get, post, ...) AllowOverride All
If you are working on something like localhost/~username/yourproject
, also check the username.conf
file in /private/etc/apache2. AllowOverride All
如果您正在使用localhost/~username/yourproject
,还请检查/ private / etc / apache2中的username.conf
文件。 I'm not an expert in Apache settings, so feel free to correct or elaborate where needed. 我不是Apache设置方面的专家,因此随时可以在需要时进行更正或详述。
Has your route file been cached? 您的路线文件是否已缓存? See what happens when you run:
查看运行时发生的情况:
php artisan route:clear
and try again. 然后再试一次。
goto htaccess in your laravel folder after ( RewriteEngine On ) add this 在(RewriteEngine On)添加后在您的laravel文件夹中转到htaccess
RewriteBase /yourlaravel project name/public
example: 例:
RewriteBase /laravel/public RewriteBase / laravel /公共
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.