简体   繁体   English

如何将基本URL更改为子目录CakePHP?

[英]How to change base url to subdirectory CakePHP?

I have a cakephp 3 script installed on my cpanel account. 我的cpanel帐户上安装了cakephp 3脚本。

this domain is the primary domain for account but i have relocated it to a subfolder for necessary reasons. 该域是帐户的主要域,但出于必要原因,我将其重新定位到子文件夹。

my htaccess rewrites it perfectly and every url works both with and without /subfolder/ in the url. 我的htaccess完美地重写了它,每个URL都可以在URL中使用/ subfolder /和不使用/ subfolder /。

However, all the links in cakephp automatically append /subfolder/ back into the url. 但是,cakephp中的所有链接都会自动将/ subfolder /附加回URL。

I even tried manually replacing $base_url in configuration.php with 'mydomain.com'; 我什至尝试用'mydomain.com'手动替换configuration.php中的$ base_url; only, but that didn't work. 仅,但是那没有用。 Then I replaced every instance in all the hundreds of files of $base_url with 'mydomain.com'; 然后,我将$ base_url的所有数百个文件中的每个实例替换为“ mydomain.com”; but still, nothing changed and it still shows that /subfolder/ in every url even when i access mydomain.com directly._ 但仍然没有任何变化,即使我直接访问mydomain.com,它也仍然在每个网址中显示/ subfolder /。

I need to get rid of this /subfolder/ in the url that cakephp is serving from php. 我需要在cakephp从php服务的URL中删除这个/ subfolder /。 i tried everything i knew but nothing works. 我尝试了所有我知道的东西,但是没有任何效果。

Please tell me how to solve this problem. 请告诉我如何解决这个问题。

Have you tried setting App.base , App.webroot ? 您是否尝试设置App.baseApp.webroot Setting those values up will disable automatic directory detection and should help you get the URLs you want. 设置这些值将禁用自动目录检测,并应帮助您获取所需的URL。 See configuration docs for more on those values. 有关这些值的更多信息,请参见配置文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM