的.htaccess的CakePHP的和Joomla的子文件夹/子域文件夹、htaccess、CakePHP、Joomla

2023-09-02 01:06:56 作者:酒自斟

我有工作Web服务器上的应用程序CakePHP的,现在我想在子域WIP的Joomla。因为我的网站主办的方式来处理子域名,我不能写适当的条件下的htaccess有它的工作。 默认情况下我的CakePHP应用程序是在/ WWW fodler在服务器上,它htacces如下所示

I have working CakePHP app on web server, and now I want to have WIP joomla on subdomain. And because of my webhosting way to deal with subdomains I'm unable to write proper conditions in htaccess to have it working. By default my CakePHP app is in /www fodler on the server and its htacces look as follows

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

我的虚拟主机提供商的方式来处理子域是内/ WWW子文件夹命名为所需的子域,并重定向到它创建的文件夹。

My webhosting provider way to deal with subdomains is to create folder inside subfolder of /www that is named as required subdomain and redirect to it.

所以,如果我想创建子域joomla.mydomain.com我要创建文件夹 / WWW / subdom /的Joomla ,比正常条件和规则添加到htaccess的

So if I want to create subdomain joomla.mydomain.com I have to create folder /www/subdom/joomla and than add proper conditions and rules to htaccess

# subdomains(with or without www in the begenning)
RewriteCond %{REQUEST_URI} !^subdom/
RewriteCond %{REQUEST_URI} !^/subdom/
RewriteCond %{HTTP_HOST} ^(www.)?(.*).([^.]*).([^.]*)$
RewriteCond %{DOCUMENT_ROOT}/subdom/%2 -d
RewriteRule (.*) subdom/%2/$1 [DPI]

但是,当这个被添加到到htaccess的CakePHP的工作和以前一样,但acessing的Joomla子域名会引发内部服务器错误。但是,如果我注释掉最后重写规则

But when this is added to to htaccess cakePHP works as before, but acessing joomla subdomain throws Internal Server Error. However if I comment out last rewrite rules

   #RewriteRule    ^$ app/webroot/    [L]
   #RewriteRule    (.*) app/webroot/$1 [L]

子域名开始正常工作。

subdomain starts working properly..

我有点卡住了这一点,所以任何帮助是AP preciated。

I'm kind of stuck on this, so any help is appreciated.

感谢

推荐答案

我写了一篇博客使用中的CakePHP的这里

I wrote a blog post on using other apps within CakePHP here

<IfModule mod_rewrite.c>
    RewriteEngine on

    RewriteRule (some_folder/.*) $1 [L] # adjust the regex to what you want.

    # normal cake rules
    RewriteRule    ^$    webroot/    [L]
    RewriteRule    (.*) webroot/$1    [L]
 </IfModule>