我正在建立一个网站来使用 Laravel 6 列出和搜索广告。
根据建议,我希望“seo 友好”的 url 看起来像这样:
https://myawesomewebsite.com/sale,shoes,new-york,xl,6,10.html
我试着这样做:
Route::get('/sale,{slugs?}.html', 'AdsController@search')->where('slugs', '(.*)');
和这个 :
Route::get('/{slugs?}.html', 'AdsController@search')->where('slugs', '(.*)');
但我收到了 404 错误。
我可以使它起作用的唯一方法是:
https://myawesomewebsite.com/sale/shoes,new-york,xl,6,10.html
Route::get('/sale/{slugs?}.html', 'AdsController@search')->where('slugs', '(.*)');
但这不是我想要的。如何在 sale 和 {slugs?} 之间用“,”替换第一个“/”?
谢谢
九州编程