저는 Laravel 4를 사용하고 있습니다. URL이 다음과 같이 보이는 cms 페이지를 만들려고합니다 : domain.tld/en/how-it-works
. 그들은 백 오피스를 사용하여 생성되며 슬러그 how-it-works
과 현재 언어를 사용하여 가져옵니다. 문제는 내가 정적 페이지 인 domain.tld/login
에 액세스하려는 경우 해당 페이지가 데이터베이스에서 발견되지 않았기 때문에 404 페이지를 표시한다는 것입니다. 그래서 주어진 슬러그를 찾을 수없는 경우 다른 경로를 찾는 솔루션을 찾고 있어요.라우팅 다시 매핑 Laravel 4
도와주세요.
영어로 죄송합니다.
$languages = array('fr', 'en');
$locale = Request::segment(1);
if(in_array($locale, $languages)){
\App::setLocale($locale);
}else{
$locale = null;
}
Route::group(array('prefix' => $locale), function()
{
Route::get('/', array('before' => 'loginCookie', 'uses' => '[email protected]', 'as' => '/'));
Route::get('{slug}',array('uses' => '[email protected]', 'as' => 'articles.show'));
Route::group(array('prefix' => 'login'), function() {
Route::get('/', array('before' => 'guest', 'after' => 'reflashPool', 'uses' => '[email protected]'));
Route::post('/',array('before' => 'guest|csrf','after' => 'reflashPool', 'uses' => '[email protected]'));
Route::get('remind-password',array('uses' => '[email protected]'));
Route::post('remind-password','[email protected]');
Route::get('reset-password/{token}','[email protected]');
Route::post('reset-password','[email protected]');
});
:
그래서, 당신은 당신의 가장 일반적인 경로 마지막을해야? – Laurence
방금 추가했습니다 :) –