2015-12-08 58 views
1

我目前在我的管理請求頁面,網址爲wwww.website.com/requests/manage/。我想回重定向到使用<a href="dashboard">dashborad</a>我的儀表板頁面,但是當我點擊我的儀表盤鏈接,則網址www.website.com/requests/manage/dashboard,而不是www.website.com/dashboardLaravel 5.1 - 重定向回基本網址

下面

是代碼回到我的儀表板頁面,

<td style="line-height:12pt; height:10px;"> 
     <a href="dashboard"><b class="brandname"> 
       dashboard</b> 
     </a> 
</td> 

這是我的routes.php文件。

Route::group(['middleware' => 'auth'], function() { 

    Route::get('dashboard', '[email protected]'); 

    // All about buyer request... 
    Route::post('requests/success', '[email protected]'); 
    Route::post('request/success', '[email protected]'); 

    Route::get('requests/new', '[email protected]'); 
    Route::get('request/new', '[email protected]'); 
    Route::get('requests/manage/{status?}', '[email protected]'); 

}); 

是我的嘗試是增加另一個路線(見下文)來解決這個問題,但我認爲是不是一個完美的解決方案。有什麼建議麼?

Route::get('requests/manage/dashboard', '[email protected]'); 

回答

2

用斜槓預先創建一個根相對URL。

<a href="/dashboard">dashboard</a> 

您還可以使用的輔助功能,如url來生成一個絕對的URL:

<a href="{{ url('dashboard') }}">dashboard</a> 

url輔助函數將創建一個絕對URL像http://website.com/dashboard

+0

它的工作!謝謝。 –