我的工作我自己的CMS,但我遇到蛞蝓一些困難,所以,這裏是我的問題:如何在根URL中使用塞
我試圖使用的蛞蝓我的網址的根像這樣:
http://domain.com/some-slug-to-some-article
在這一點上,我有以下的條目在我的應用程序/ routes.php文件
Route::get('/', '[email protected]');
Route::get('/{slug?}', '[email protected]');
當我試圖進入到出現問題「登錄」 默認情況下是在/ home(我在Laravel 5.1中使用腳手架進行用戶身份驗證)
當我輸入domain.com/home的URL時,它仍然將其稱爲slug。
這裏是我的路線:名單
+--------+--------------------------------+-------------------------------------------------------+----------------------+------------------------------------------------------------+------------+
| Domain | Method | URI | Name | Action | Middleware |
+--------+--------------------------------+-------------------------------------------------------+----------------------+------------------------------------------------------------+------------+
| | GET|HEAD |/ | | App\Http\Controllers\[email protected] | |
| | POST | auth/login | | App\Http\Controllers\Auth\[email protected] | guest |
| | GET|HEAD | auth/login | | App\Http\Controllers\Auth\[email protected] | guest |
| | POST | auth/login/{one?}/{two?}/{three?}/{four?}/{five?} | | App\Http\Controllers\Auth\[email protected] | guest |
| | GET|HEAD | auth/login/{one?}/{two?}/{three?}/{four?}/{five?} | | App\Http\Controllers\Auth\[email protected] | guest |
| | GET|HEAD | auth/logout | | App\Http\Controllers\Auth\[email protected] | |
| | GET|HEAD | auth/logout/{one?}/{two?}/{three?}/{four?}/{five?} | | App\Http\Controllers\Auth\[email protected] | |
| | POST | auth/register | | App\Http\Controllers\Auth\[email protected] | guest |
| | GET|HEAD | auth/register | | App\Http\Controllers\Auth\[email protected] | guest |
| | GET|HEAD | auth/register/{one?}/{two?}/{three?}/{four?}/{five?} | | App\Http\Controllers\Auth\[email protected] | guest |
| | POST | auth/register/{one?}/{two?}/{three?}/{four?}/{five?} | | App\Http\Controllers\Auth\[email protected] | guest |
| | GET|HEAD|POST|PUT|PATCH|DELETE | auth/{_missing} | | App\Http\Controllers\Auth\[email protected] | guest |
| | GET|HEAD | home | | \Bestmomo\Scafold\Http\Controllers\[email protected] | auth |
| | POST | home/article | home.article.store | App\Http\Controllers\[email protected] | auth |
| | GET|HEAD | home/article | home.article.index | App\Http\Controllers\[email protected] | auth |
| | GET|HEAD | home/article/create | home.article.create | App\Http\Controllers\[email protected] | auth |
| | GET|HEAD | home/article/{article} | home.article.show | App\Http\Controllers\[email protected] | auth |
| | PUT | home/article/{article} | home.article.update | App\Http\Controllers\[email protected] | auth |
| | DELETE | home/article/{article} | home.article.destroy | App\Http\Controllers\[email protected] | auth |
| | PATCH | home/article/{article} | | App\Http\Controllers\[email protected] | auth |
| | GET|HEAD | home/article/{article}/edit | home.article.edit | App\Http\Controllers\[email protected] | auth |
| | GET|HEAD | password/email/{one?}/{two?}/{three?}/{four?}/{five?} | | App\Http\Controllers\Auth\[email protected] | guest |
| | POST | password/email/{one?}/{two?}/{three?}/{four?}/{five?} | | App\Http\Controllers\Auth\[email protected] | guest |
| | POST | password/reset/{one?}/{two?}/{three?}/{four?}/{five?} | | App\Http\Controllers\Auth\[email protected] | guest |
| | GET|HEAD | password/reset/{one?}/{two?}/{three?}/{four?}/{five?} | | App\Http\Controllers\Auth\[email protected] | guest |
| | GET|HEAD|POST|PUT|PATCH|DELETE | password/{_missing} | | App\Http\Controllers\Auth\[email protected] | guest |
| | GET|HEAD | {slug?} | | App\Http\Controllers\[email protected] | |
+--------+--------------------------------+-------------------------------------------------------+----------------------+------------------------------------------------------------+-------------
因此,在短期的話,我想有在URL的根目錄下的蛞蝓,而且,我想「排除」某些路線,它保留對系統本身。
感謝您的幫助。
嘗試使'slug'參數爲必填項,即'{slug}'。 –
嗯我有使用Laravel 4相同的情況下,但我已經通過定義我的slu routes路線**後**所有其他路線固定。你可以嘗試做相反的事情,但我懷疑他們已經改變了很多邏輯。更好的建議是嘗試從slug路徑中刪除問號,從而使其成爲強制性的 – Avalanche
@StuartWagner我也試過了。沒有工作。 – AndreX