这是我的.htaccess,位于public_html
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
我有一个(传统的)CakePHP应用程序在public_html / app中运行maindomain.com
我在public_html / otherdomain下添加了一个addon domain otherdomain.com。 但是,在尝试加载索引页时,它会返回500服务器错误。
删除public_html / .htaccess允许正确浏览otherdomain.com,但CakePHP应用程序(maindomain.com)会出现路由问题。
这是public_html / app下的CakePHP .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
答案 0 :(得分:1)
您的主htaccess似乎正在将流量重定向到您的app / webroot /,这会导致otherdomain.com出现问题。 也许你可以检查输入的主机名并根据它重定向。 这样的事情。
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^maindomain\.com [NC]
RewriteRule ^(.*)$ app/webroot/$1 [L]
RewriteCond %{HTTP_HOST} ^otherdomain\.com [NC]
RewriteRule (.*) http://otherdomain.com/$1 [L]
</IfModule>