.htaccess 在使用域名之前的www时,Cakephp重定向到/app/webroot

.htaccess 在使用域名之前的www时,Cakephp重定向到/app/webroot,.htaccess,cakephp,.htaccess,Cakephp,例如,当我用“www”输入域名时,一切正常,但当我使用前面有“www”的同一域名时,它会重定向到/app/webroot,这会给出错误。有什么问题吗 我使用默认的cakephp.htaccess文件 <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] </IfModule> 重新

例如,当我用“www”输入域名时,一切正常,但当我使用前面有“www”的同一域名时,它会重定向到/app/webroot,这会给出错误。有什么问题吗

我使用默认的cakephp.htaccess文件

<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteRule    ^$ app/webroot/    [L]
 RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>

重新启动发动机
重写规则^$app/webroot/[L]
重写规则(*)app/webroot/$1[L]

您可以首先在
apache\conf\httpd.conf
文件中检查您的重写模式是否处于打开状态

检查
httpd.conf
文件中的以下代码

#LoadModule rewrite_module modules/mod_rewrite.so
在此行中删除散列并重新启动apache服务器

然后你就可以开始了

RewriteBase /YOURPATH/ 

面对

我想你可以试试这个

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /YOURPATH/
    RewriteRule    ^$    app/webroot/    [L]
    RewriteRule    (.*) app/webroot/$1    [L]

 </IfModule>

重新启动发动机
重写基本路径/你的路径/
重写规则^$app/webroot/[L]
重写规则(*)app/webroot/$1[L]

问题很可能出在您的虚拟主机上。请出示网站的vhost条目好吗?
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /YOURPATH/
    RewriteRule    ^$    app/webroot/    [L]
    RewriteRule    (.*) app/webroot/$1    [L]

 </IfModule>