2011-05-20 104 views
2

我在我的網站有一個Wordpress運行在根目錄下,即:mysite.com/Wordpress和Zend框架應用程序工作togheter?

我需要創建一個ZF應用程序,並將其託管在我的託管的子目錄下,即:mysite.com/後端

我做我的根目錄下:

%ZF創建項目後端

它創造了「後端」目錄我的根目錄下,裏面所有的項目。

在我的根目錄我有這個.htaccess文件:

RewriteEngine On 
RewriteBase/
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 

在根目錄/後端/公共我有這樣的.htaccess

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} -s [OR] 
RewriteCond %{REQUEST_FILENAME} -l [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule ^.*$ - [NC,L] 
RewriteRule ^.*$ index.php [NC,L] 

我使用ZF 1.11

我無法確定如何配置.htaccess文件才能使此zf應用程序在子目錄下工作。

問候!

回答

0

我不得不把這個.htacess內mysite.com/backend

RewriteEngine On 
RewriteRule !\.(csv|js|gif|jpg|png|css|txt)$ public/index.php [L] 

然後在我的bootstrap.php這個:

public function run() { 
     $front = $this->getResource('FrontController'); 
     $front->setBaseUrl('/backend'); 
} 

所以Zend的路線可以以正確的方式請求。

1

目前你有一個文件夾後端。因此,它看起來

mysite.com/backend

現在,當您創建項目,

zf create project <project name> 

你會得到一個目錄結構。從那裏移動index.php和.htaccess(從公共文件夾)到後端文件夾。

將所有剩餘的文件夾上傳到無法通過網絡訪問的文件夾。即低於web根目錄(公共或任何你所稱的)

根據你的項目文件夾現在改變後臺文件夾的index.php APPLICATION_PATH。

它非常容易與zend框架。希望這會幫助你。

可能你想看看wordpress .htaccess是否允許已經存在的目錄。