【问题标题】:Laravel Dose not redirect to base urlLaravel Dose 不会重定向到基本网址
【发布时间】:2018-01-08 09:54:36
【问题描述】:

我的第一个网址是
http://mydomain.localhost/myfolder/public/test

当我在控制器上使用此命令进行重定向时

return redirect()->route('test.index', $domain);

将我重定向到http://mydomain.localhost/test,我想将我重定向到http://mydomain.localhost/myfolder/public/test

注意:我知道redirect()->back(),但我不想使用它。因为有时我希望重定向到其他页面。

我的路线:

Route::group(array('domain' => '{account}.localhost'), function () {
   Route::resource('/test', 'testController', 
      ['middleware' => 'Subdomain', function ($account) {
}]); 

【问题讨论】:

  • 你正在重定向到一个命名的路由并且没有提供那个路由配置。
  • 看起来您的网络服务器配置不正确。
  • 写下你的路线并解释更多
  • 我编辑我的帖子并写下我的路线

标签: php laravel redirect laravel-5 laravel-5.4


【解决方案1】:

首先检查您的路线列表并找出您的预期路线。那么

return redirect()->route('test.index');

【讨论】:

    【解决方案2】:

    您需要在 .env 文件上配置 APP_URL。因为默认的 APP_URL 是你的本地主机。

    【讨论】:

    • 您能否将其添加到您的 .htaccess 文件中。 RewriteBase /myfolder/public
    猜你喜欢
    • 2018-09-19
    • 1970-01-01
    • 2014-06-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-08
    • 2016-11-15
    • 2021-01-13
    • 1970-01-01
    相关资源
    最近更新 更多