2013-10-31 102 views
0

我在Web服務器上工作CakePHP應用程序,現在我想在子域上有WIP joomla。由於我的網站託管方式來處理子域名,我無法在htaccess中編寫適當的條件來使其工作。 默認情況下,我的CakePHP應用程序是在服務器/網絡fodler及其htacces如下所示。CakePHP和子文件夾/子域中的joomla的.htaccess

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

我的虛擬主機提供商的方法來處理子域是內/ WWW的子文件夾命名爲所需的子域創建的文件夾並重定向到它。

所以,如果我想創建一個子域joomla.mydomain.com我要創建文件夾 /WWW/subdom /的Joomla比適當的條件和規則添加到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的工作如前,但訪問Joomla子域引發內部服務器錯誤。但是,如果我評論出最後一條重寫規則,則可以使用

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

子域名開始正常工作。

回答

0

我寫了一篇博客文章上使用內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> 
其他應用