Php Laravel路线不起作用
当我写这个Php Laravel路线不起作用,php,url,laravel-5,laravel-4,routes,Php,Url,Laravel 5,Laravel 4,Routes,当我写这个Route::get('/','Login@index'); 并使用url ""行得通, 但是当我使用这个Route::get('home','Login@index'); url“”它给出404错误请尝试使用前面的/更改您的路线,如下所示: Route::get('/home','Login@index'); 虽然这不是它的记录方式,但这对我来说在许多项目上都是有效的。如果你想同时使用/and/home作为主页 Route::get('/{home?}', 'Login@index'
Route::get('/','Login@index');代码>
并使用url
""行得通,
但是当我使用这个Route::get('home','Login@index');代码>
url“”它给出404错误请尝试使用前面的/
更改您的路线,如下所示:
Route::get('/home','Login@index');代码>
虽然这不是它的记录方式,但这对我来说在许多项目上都是有效的。如果你想同时使用/and/home作为主页
Route::get('/{home?}', 'Login@index');
或者你可以把它写成两半
Route::get('/', 'Login@index');
Route::get('home', 'Login@index');
第一次
您应该检查错误日志文件中的内容,通常在
存储/logs/laravel.log
这将为您提供有关此URL找不到它的原因的信息
秒
请检查web服务器上的配置:
Apache
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;
}
第三
请报告这次测试的结果 如果使用这个Route::get('home','Login@index');代码>我的意思是你应该保留两个路由::get('/','Login@index'); 路线::get('home','Login@index');, 当您想使用Route::get('home','Login@index');显示项目根目录的配置,例如apache2的DocumentRoot