我正在將我的個人網站轉換爲Laravel。我把舊的網站到public
文件夾,並且具有以下包羅萬象的路線,回到屬於舊網站(放置在結束我的路線文件):Laravel爲什麼給我一個無限的重定向?
Route::any('{all}', array('use' => Redirect::to('{all}')));
我已經轉換了一次一頁,到目前爲止一切都進展順利。然而,將一個頁面,humor
後,火狐給了我這個錯誤:
The page isn't redirecting properly. Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
我檢查了Apache日誌,並注意到它交替下面之間幾次:
"GET /humor HTTP/1.1"
"GET /humor/ HTTP/1.1"
相關路線:
Route::resource('humor', 'HumorController');
控制器的方法是:
public function index() {
return View::make("humor.index");
}
的觀點是:
@extends('master')
@section('title')
Humor
@stop
@section('content')
[snip]
<p><a href="/humor/jokes.php">Jokes</a></p>
<p><a href="/humor/jokes_new.php">Jokes (Testing)</a></p>
<p><a href="/humor/xkcd.php">xkcd</a></p>
@stop
這些鏈接是目前對舊網站的頁面。