mardi 21 avril 2020

Laravel route to check for multiple string checks

I want redirect (301) for some routes which contains the following -

page=1 (query string) or index.php or ?&(query string)

I have added the route as -

Route::get('/{any_url}', 'UsersController@processRedirect')->where('any_url', '(.*)index\.php(.*)|(.*)page=1(.*)|(.*)|?&(.*)');

When I am checing in https://regex101.com/ it is working but in my app iit iis not working.

What could be the issue?

I have done this via MiddleWare but I do not want to check for all urls.

Is there any other way to achieve this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire