【发布时间】:2019-11-10 19:13:57
【问题描述】:
我以为这会很简单,但我很难过。
我的站点导航上有一个链接,该链接指向一个 aws pdf 文件并且工作正常。我正在尝试创建一个用户可以输入并重定向到该文件的命名路由,但我得到了 404。
我试过了:
Route::get('Documents', function () {
return redirect()->away('http://s3.aws/documents.pdf');
});
Route::get('Documents', function () {
return redirect()->to('http://s3.aws/documents.pdf');
});
Route::get('Documents', function () {
return redirect('http://s3.aws/documents.pdf');
});
当我访问 www.mysite.com/Documents 时,它们都会导致 404
有什么想法吗?
【问题讨论】:
-
你确定你有正确的 aws 链接吗?
-
是的,我将它从工作链接复制到了路线
-
当你输入
php artisan route:list时知道错误是什么会很有用,好像 Laravel 无法列出路线,更有可能它不会在你请求站点时注册它们,所以你得到这些 404 -
好点。这是 routes.php 中的语法错误,然后是 bootstrap/cache/compiled.php 中的 5 个错误的堆栈跟踪