' /'路线正在运行,但是' / login'路线在Laravel不起作用

时间:2017-01-16 09:36:45

标签: php .htaccess laravel apache2

服务器的操作系统是Debian 8.6(jessie)......
index.php和.htaccess文件位于/ var / www / html中,Laravel项目位于/ var / www
从index.php,我可以要求autloload.php和app.php文件,我可以浏览主页(' /')。
但是,当我尝试浏览登录(' / login')页面时,此错误显示为

  

在此服务器上找不到请求的URL /登录名。

html文件夹中的.htaccess文件是 -

<IfModule mod_rewrite.c>
  <IfModule mod_negotiation.c>
    Options -MultiViews
  </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>


这里可能出现什么问题?

我在web.php文件中设置了登录路径..

1 个答案:

答案 0 :(得分:0)

您可以通过在路径文件中配置来实现/login路径。这样的事情。

Route::get('/login', function(){
  return View::make('user-login');
});

如果您要将另一个文件夹放入登录名,可以这样做。

Route::group(['prefix' => 'login'], function() {

  Route::get('/', function(){
    return View::make('portal/user-login');
  });

  Route::get('/forgot-password', function(){
    return View::make('portal/user-forgot');
  });

  Route::get('/reset-password', function(){
    return View::make('portal/user-reset');
  });

  Route::get('/dashboard', function(){
    return View::make('portal/dashboard');
  });

});

<强>解释

Route:get()将是指定您的网址路径的函数。同时,return View::make('portal/user-login')将是您定位file-blade.php的功能。

我放置并整理了我的登录文件夹并使用Route::group,而不是将Route::get('login/')全部放到我的所有代码中。

希望得到这个帮助。