I'm building a website to list and search ads with Laravel 6.
Based on recommendations i i want to have "seo friendly" url looks like this :
https://myawesomewebsite.com/sale,shoes,new-york,xl,6,10.html
I tryied do to this :
Route::get('/sale,{slugs?}.html', 'AdsController@search')->where('slugs', '(.*)');
and this :
Route::get('/{slugs?}.html', 'AdsController@search')->where('slugs', '(.*)');
But i got a 404 error.
The only way i can make it works, it's like this :
https://myawesomewebsite.com/sale/shoes,new-york,xl,6,10.html
Route::get('/sale/{slugs?}.html', 'AdsController@search')->where('slugs', '(.*)');
But it's not what i want. How can i replace the first "/" by a "," between sale and {slugs?} ?
Thanks
I have just tested following:
Route::get('/sale{slugs?}.html', function() {
echo "Works!";
})->where('slugs', '(.*)');
It is working with http://[host]/sale,shoes,new-york,xl,6,10.html
However this is Laravel 4.2.22
but I believe that should work for you as well.