当我写这篇文章Route::get('/', '[email protected]');
Laravel路线行不通
,并使用网址
“http://localhost/laravel-4.2.11/blog/” 它的工作原理,
但是当我使用这个Route::get('home', '[email protected]');
和URL “http://localhost/laravel-4.2.11/blog/home” 它给404错误
当我写这篇文章Route::get('/', '[email protected]');
Laravel路线行不通
,并使用网址
“http://localhost/laravel-4.2.11/blog/” 它的工作原理,
但是当我使用这个Route::get('home', '[email protected]');
和URL “http://localhost/laravel-4.2.11/blog/home” 它给404错误
如果你想同时使用/和/ home的主页,
Route::get('/{home?}', '[email protected]');
或者,你可以写一分为二,
Route::get('/', '[email protected]');
Route::get('home', '[email protected]');
如果使用这种'路线::得到它不工作('home','Login @ index');' –
我的意思是你应该保持两个Route :: get('/','Login @ index'); Route :: get('home','Login @ index');,不仅仅当你想使用Route :: get('home','Login @ index')时, –
我做到了。我把两个都试过但没有工作 –
弗里斯特
你应该检查你在错误日志文件中有什么,通常在
存储/日志/ laravel.log
https://laravel.com/docs/5.4/errors
这应该给你,为什么这个网址无法找到它的信息。
二
请检查你的web服务器上的配置:
https://laravel.com/docs/5.4/installation#web-server-configuration
阿帕奇
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule^index.php [L]
Nginx的
location/{
try_files $uri $uri/ /index.php?$query_string;
}
三
请报告这个测试的结果...
没有不工作... –