Laravel 5 - 无法在生产服务器上重置密码 404 - 未找到
Laravel 5 - can not reset password on production server 404 - Not Found
有人知道为什么路由“/password/email”returns 404 Not Found 错误在生产服务器上,但在本地有效吗?
当用户尝试通过电子邮件重置密码时(https://compariimobiliare.ro/password/reset), the POST URL https://compariimobiliare.ro/password/email 给出 404 未找到错误。同样 URL 在本地服务器上工作正常,但在生产环境中不工作。
路由就在那里,我运行命令就可以看到:
php artisan route:list
POST | password/email | | App\Http\Controllers\Auth\ForgotPasswordController@sendResetLinkEmail | web,guest
Laravel 默认实现:
public function sendResetLinkEmail(Request $request)
{
$this->validate($request, ['email' => 'required|email']);
// We will send the password reset link to this user. Once we have attempted
// to send the link, we will examine the response then see the message we
// need to show to the user. Finally, we'll send out a proper response.
$response = $this->broker()->sendResetLink(
$request->only('email')
);
if ($response === Password::RESET_LINK_SENT) {
return back()->with('status', trans($response));
}
// If an error was returned by the password broker, we will get this message
// translated so we can notify a user of the problem. We'll redirect back
// to where the users came from so they can attempt this process again.
return back()->withErrors(
['email' => trans($response)]
);
}
我可以看到您有 POST 条通往 password/email 的路线。
你也有 password/email 的 GET 路由吗?
您收到 404 是因为它正在尝试访问 GET 路由。
有人知道为什么路由“/password/email”returns 404 Not Found 错误在生产服务器上,但在本地有效吗?
当用户尝试通过电子邮件重置密码时(https://compariimobiliare.ro/password/reset), the POST URL https://compariimobiliare.ro/password/email 给出 404 未找到错误。同样 URL 在本地服务器上工作正常,但在生产环境中不工作。
路由就在那里,我运行命令就可以看到:
php artisan route:list
POST | password/email | | App\Http\Controllers\Auth\ForgotPasswordController@sendResetLinkEmail | web,guest
Laravel 默认实现:
public function sendResetLinkEmail(Request $request)
{
$this->validate($request, ['email' => 'required|email']);
// We will send the password reset link to this user. Once we have attempted
// to send the link, we will examine the response then see the message we
// need to show to the user. Finally, we'll send out a proper response.
$response = $this->broker()->sendResetLink(
$request->only('email')
);
if ($response === Password::RESET_LINK_SENT) {
return back()->with('status', trans($response));
}
// If an error was returned by the password broker, we will get this message
// translated so we can notify a user of the problem. We'll redirect back
// to where the users came from so they can attempt this process again.
return back()->withErrors(
['email' => trans($response)]
);
}
我可以看到您有 POST 条通往 password/email 的路线。 你也有 password/email 的 GET 路由吗? 您收到 404 是因为它正在尝试访问 GET 路由。