【问题标题】:how to remove app name from http://localhost/website/app/controller/action in redirect?如何在重定向中从 http://localhost/website/app/controller/action 中删除应用程序名称?
【发布时间】:2011-08-19 12:57:04
【问题描述】:

我在 cakephp 中有联系我们页面并且我已经使用了

http://localhost/parcel3/contact-us

对于呼叫联系我们页面,在此页面中,我发送了一封电子邮件和 setFlash 消息并在联系我们页面上重定向,但重定向后我的网址转换为

http://localhost/parcel3/app/contact-us

但我需要http://localhost/parcel3/contact-us,我更改了路由文件以在 url 中不显示“应用程序”但是当页面重定向时显示如何更改它。

【问题讨论】:

  • 你能把你的 $this->redirect() 的代码贴出来
  • 您在 Apache 中的 DocumentRoot 设置是什么?

标签: php .htaccess cakephp routes


【解决方案1】:

你如何重定向? 有一个数组网址?或字符串网址? 我打赌后者...请发布您的重定向代码。

PS:我强烈建议您使用虚拟主机: http://www.dereuromark.de/2011/05/29/working-with-domains-locally/

它让您的生活更轻松,并模拟您的实时服务器的位置。不再有重定向问题以及其他一些优点。

【讨论】:

  • $this->redirect(array('action' => 'contact-us'));
猜你喜欢
  • 2017-06-30
  • 1970-01-01
  • 2011-09-26
  • 2013-01-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-12-24
  • 1970-01-01
相关资源
最近更新 更多