【问题标题】:Redirect to Laravel framework page重定向到 Laravel 框架页面
【发布时间】:2023-11-22 16:46:01
【问题描述】:

我需要从 CGI 重定向到在 Laravel 中创建的同一服务器的页面。当我使用浏览器中的路径时,它不会出现问题,但是当使用 CGI 时,Laravel 会向我显示错误。

https://myserver:8080/bitacora/index.php/devices

使用来自 CGI 的 Location: /bitacora/index.php/devices 标头时出错

我在 PHP 中看到的唯一区别是它不使用 QUERY_STRING,但“参数”由 PHP_SELF 变量传递。

关于如何正确行事的任何想法?我记得有些框架会重定向到一个变量,例如 moduleaction。 Laravel 中有类似的东西吗?

【问题讨论】:

  • Location: /bitacora/index.php/devices 喜欢Location: https://myserver:8080/bitacora/index.php/devices 时你试过完整的URL
  • 完美!我用echo "Location: http://${HTTP_HOST}${MVTO}" 替换并且工作正常。感谢那。请添加答案进行检查。
  • PS:mod_rewrite 切换到https
  • 我发表了我的评论作为你所说的答案。这可能会对其他观众有所帮助。

标签: php laravel http-headers cgi


【解决方案1】:

使用完整的网址 不只是 Location: /bitacora/index.php/devices

但是用下面的替换它 Location: http://myserver:8080/bitacora/index.php/devices.

【讨论】: