我用這個撞牆了...在子目錄中的Zend Framework
我需要在子目錄內建立一個zend框架應用程序。
即域是tricell.ss和我想使用tricell.ss /三電池作爲應用程序的主目錄。
Whate've完成:
我在我的配置設置好的了(的application.ini)中:
resources.frontController.baseUrl = "/tricell"
我在我的配置做出另一個變種
baseUrl = "/tricell"
在我的Boostrap我有這個:
$router = new Zend_Controller_Router_Rewrite(); $frontController->setRouter($router); $frontController->setBaseUrl($this->config->baseUrl); $frontController->dispatch();
在我的佈局,我想用顯示圖像:
$this->baseUrl('/img/btn.png')
這裏是我的虛擬主機配置:
<VirtualHost *:80> DocumentRoot "/HTDOCS/tricell/tricell/public_html" ServerName tricell.ss RewriteRule ^$ [L] RewriteEngine On RewriteCond %{HTTP_HOST} ^(www.)?tricell.ss$ RewriteRule ^(/)?$ tricell [L] </VirtualHost>
這裏是我的.htaccess:
SETENV APPLICATION_ENV發展
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
問題是當我試圖顯示圖像什麼也沒有發生。當我試圖通過URL來獲取圖像:
http://tricell.ss//tricell/img/btn.png
我收到有關錯誤信息控制器。我如何才能做到這一點?我可以(沒有任何問題)像tricell.ss那樣爲根域進行配置,然後獲取圖像,例如tricell/ss/img/btn.png,但是我想在子目錄上工作,而且我無法在圖像上執行此操作。我在這裏做錯了什麼?
如果我沒有更改任何虛擬主機,我想我需要在public_html中添加一個.htaccess,如果我錯了,請糾正我。不幸的是你的解決方案不起作用。輸入時有404個屏幕:domain.local/tricell/index – Ertai
您不必在public_html中有任何特殊的.htaccess文件,只需在public_html/tricell中使用Zend Framework .htaccess和index.php。你也應該把你的資源,如圖像和CSS在public_html/tricell也。我們用index.php改變的一個事實是,核心應用程序並沒有在公共目錄中居高一級。在這種情況下,它在它自己的文件夾中有兩層。我能夠讓這個設置在我的網站上工作,只需要改變index.php,它定義了APPLICATION_PATH。讓我知道如何去NM – drew010
,我看你現在工作。 – drew010