working with Laravel 9 and this is working fine in my localhost. but when i deploy it with shared hosting on hostgrator and click contact form it is encountered following error messages
SymfonyComponentHttpKernelExceptionMethodNotAllowedHttpException The GET method is not supported for this route. Supported methods: POST.
I have following contact form in the blade file
<div class="content">
@include('partials.alerts')
<h1 class="heading">Contact Us</h1>
<form method="post" action="{{url('form')}}#contact">
{{method_field('POST')}}
{{csrf_field()}}
<div class="form">
<div class="input-flex">
<input type="text" name="name" placeholder="Name*" /><br><br>
<span style="color:red">@error('name'){{$message}}@enderror</span>
<input type="email" name="email" placeholder="E-mail*" /><br><br>
<span style="color:red">@error('email'){{$message}}@enderror</span>
<input type="tel" class="full-width" name="telephone" placeholder="Phone number*" /><br><br>
<span style="color:red">@error('telephone'){{$message}}@enderror</span>
<textarea cols="2" rows="2" class="full-width" name="message" placeholder="Message"></textarea>
</div>
<button class="conbtn" type="submit">Submit</button>
</form>
and web.php
Route::get('/', function () {
return view('welcome');
});
Route::post('form','AppHttpControllersUserController@store');
Route::get('/user/verify/{token}', 'AppHttpControllersUserController@verifyUser');
how could I fix this problem?
2
Answers
Please try to clear route cache:
It’s help me
You said you’re using Laravel 9 but the syntax you’re using is in old format.
Try updating to the following:
Also update the routes:
You may also create a route that runs optimize clear:
Let us know if this solves the problem.