mercredi 16 septembre 2020

How to redirect HTTP request to a new path through middle-ware in laravel

Through middleware I want to regenerate upcoming requests to a new path. like my requested path is: resource-controller/my-resource-method. But before searching this route in web.php or routes.php file I want it to be get converted as resourceController/myresourcemethod.

How can I do this?

as I don't want declare separate route in routes file. Here I have created a new middleware and also have initialize it in kernel.php but in middleware handle how can I get request path except of base path so that I can change it accordingly and redirect to newly generated path.

Actually I have a specific pattern of requested urls so I want them to directoly point to the controller method instead of declaring routes for them. Or there is any better way to solve it.

I am working with laravel 7.1



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire