So I already looked at the answers that are related to my issue. I have a laravel application which is working great on my localhost server. Routes are working fine there. But when I uploaded my laravel application on shared hosting, only GET methods are working. When I try to use any POST request such as login to my application, it sends 405 error code. So i'll show you what is wrong when I login for example.
This is the route.
Route::post('authinticate',['as'=>'authinticate','uses'=>'LoginController@authenticate']);
The controller function
public function authenticate(LoginRequest $request)
{ //$credentials = $request->only('user_name', 'password');
$credentials = array(
'user_name' => $request->input('username'),
'password' => $request->input('password'),
);
if (Auth::attempt($credentials)) {
// Authentication passed...
return redirect()->route('home');
}
else{
return redirect()->back()->withErrors(['message' => 'اسم المستخدم او كلمة المرور غير صحيحين.']);
}
}
HTML form:
<form method="POST" action="{{ route('authinticate') }}">
@csrf
<div class="form-group signIn">
<label for="username">اسم المستخدم</label>
<input type="text" name="username" placeholder="اسم المستخدم" class="form-control" id="username" value="{{ old('user_name') }}">
</div>
<div class="form-group">
<label for="password">كلمة المرور</label>
<input type="password" name="password" placeholder="كلمة المرور" class="form-control" id="password">
<p></p>
<a href="{{ route('forgot') }}" >نسيت كلمة المرور</a>
</div>
<input type="submit" class="btn btn-block btn-default btn-success" name="submit" id="submit" value="دخـــول">
</form>
This is what I get from console before submitting the form.
Mixed Content: The page at 'https://www.aouacc.net/login' was loaded over a secure connection, but contains a form that targets an insecure endpoint 'http://www.aouacc.net/authinticate'. This endpoint should be made available over a secure connection.