12

これを使用Redirect::to($url)すると、結果は次のようになります。

http://localhost/http://mysite.com/foo/bar.html

しかし、私がRedirect::to('http://google.com')それを使用すると、問題なくグーグルに行きます。私の問題は何だと思いますか?

4

3 に答える 3

24

メソッドに完全修飾 URL を提供する必要がありますRedirect::to()。そうしないと、アプリケーションのベース URL が先頭に追加されます。

$url = 'www.google.com';
// redirects to http://localhost:8888/www.google.com
return Redirect::to($url);

$url = 'http://google.com';
// redirects to http://google.com
return Redirect::to($url);
于 2013-09-04T06:31:35.753 に答える
4

外部ドメインにリダイレクトするには、tiqeet.com などの完全修飾 URL を使用します

コントローラーで、return Redirect::intended("完全修飾ドメイン"); を呼び出します。

それがあなたのために働くことを願っています。laravel 4.0で使用しました

于 2014-02-12T10:29:34.817 に答える