Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

cihib's avatar
Level 1

Post request in browser returns exception

Hello, I want redirect back for users who enter a url for a post. I have the following route:

Route:post('postmethod-uri', 'SomeController@postfunction');

if i enter this url example.com/postmethod-uri I get an error

Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException

Why is that? Can someone help!

0 likes
5 replies
bobbybouwmann's avatar
Level 88

You have a post route, however your browser can only handle get routes if you type in an url in the browser. There is no route to match for get so it tries the post route. However the method is incorrect so Laravel throws you this exception!

You can either create the get route and let that redirect or handle the exception in the app/Exceptions/Handler.php file and do something with that.

siangboon's avatar

double check your method and the uri, any typo error or case sensitive ...

cihib's avatar
Level 1

So I can't do a get request. How do I test the post request in the browser?

bobbybouwmann's avatar

So you either make a button on the screen to perform the post action or you use a tool like postman to post those actions.

cihib's avatar
Level 1

Thanks for the quick reply. I will build a button for testing, I don't understand post man yet

Please or to participate in this conversation.