【问题标题】:Laravel5:Redirect::to() outside link NotFoundHttpException in RouteCollection.phpLaravel5:Redirect::to() 外部链接 NotFoundHttpException 在 RouteCollection.php
【发布时间】:2016-12-02 13:23:01
【问题描述】:

我正在开发一个 Laravel 5 应用,我有这条路线

Route::get('/go','UrlController@index');

在这个 UrlController.php 中,我有这个索引方法

public function index(){
    return Redirect::to('www.google.com',302);
}

当我测试这个网址时http://localhost:8000/go 它只是更改为http://localhost:8000/www.google.com 并出现此错误NotFoundHttpException in RouteCollection.php line 161 那是什么问题,谢谢

【问题讨论】:

  • 尝试在 www.google.com 前添加 http://

标签: php laravel laravel-routing


【解决方案1】:

您应该在 www.google.com 之前添加协议

public function index(){
    return Redirect::to('https://www.google.com',302);
}

【讨论】:

    猜你喜欢
    • 2016-10-10
    • 1970-01-01
    • 2022-11-20
    • 2015-06-06
    • 2018-07-29
    • 2017-01-10
    • 2017-10-10
    • 1970-01-01
    相关资源
    最近更新 更多