【问题标题】:How can I change the website document root?如何更改网站文档根目录?
【发布时间】:2014-06-22 07:47:48
【问题描述】:

我想将我的文档根目录从 public_html 移动到 public_html/new_version/。我使用 .htaccess 完成此操作

RewriteRule    ^$    new_version/    [L]
RewriteRule    (.*) new_version/$1    [L]

它工作正常,但我的 CakePHP 应用程序中的链接出现了:domain.com/new_version/the-link-is-shown-here/

我想完全更改文档根目录,或者让链接显示时没有“/new_version/”文件夹名称。

【问题讨论】:

  • I want to either change completely the document root - 你为什么不这样做,让你的 apache 主机指向 whatever/app/new_version 而不是 whatever
  • @AD7six 这绝对是最好的选择。但是“public_html”暗示了 CPanel 和可能的共享主机 :) 在这种情况下,他将无法更改文档根目录。

标签: cakephp


【解决方案1】:

您可以将 core.php 中的App.baseUrl config 设置为/

【讨论】:

  • 我试过了,它给了我所有内容的断开链接。所有静态资源链接都以 /app/webroot/ 开头,例如:/app/webroot/favicon.ico @ADmad
猜你喜欢
  • 1970-01-01
  • 2016-04-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-04-26
  • 1970-01-01
相关资源
最近更新 更多