域通过mod_rewrite重定向到suddirectory,但是cakePHP弄乱了URL

问题描述

|| 目前,我的主域已从根目录重定向到子目录。因此,每次我使用cakePHP编写URL或获取当前URL时,它都会显示子目录。 例如: 如果我在主页(http://example.com)上,然后使用cake \的
$this->url
,它将返回/ mysubdirectory / 这是我在根目录中使用的.htaccess文件(当然,为了适应需要而修改),该文件重定向到子目录。
# Hostmonster.com
# .htaccess main domain to subdirectory redirect
# Copy and paste the following code into the .htaccess file
# in the public_html folder of your hosting account
# make the changes to the file according to the instructions.
# Do not change this line.
RewriteEngine on
# Change yourdomain.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$
# Change \'subdirectory\' to be the directory you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/subdirectory/
# Don\'t change this line.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change \'subdirectory\' to be the directory you will use for your main domain.
RewriteRule ^(.*)$ /subdirectory/$1
# Change yourdomain.com to be your main domain again.
# Change \'subdirectory\' to be the directory you will use for your main domain
# followed by / then the main file for your site,index.php,index.html,etc.
RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$
RewriteRule ^(/)?$ subdirectory/index.php [L]
我觉得我需要在我的cakePHP应用程序旁边修改.htaccess文件,以忽略子目录,但是我不确定如何。     

解决方法

你加了吗
RewriteBase /subdirectory/
在/ app和/ cake文件夹所在目录的.htaccess中?     

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...