我需要将一个zend项目放在我的根服务器的子目录中。我想要我的项目:“http://blog.com/site”,而不是“http://blog.com”。 为了做到这一点,我在文件中添加了: /application/configs/application.ini 以下一行:
resources.frontController.baseUrl = "http://blog.com/site"
但当我访问“http://blog.com/site”时,它返回此错误:
指定的控制器无效(站点)
如果我在下面的行中放入引导程序:
$fc = Zend_Controller_Front::getInstance();
echo $fc->getBaseUrl();
它写了“http://blog.com/site”
如何将子目录“/ site”作为控制器?因为我希望它作为网址的一部分。
答案 0 :(得分:3)
将RewriteBase添加到.htaccess
<IfModule mod_rewrite.c>
RewriteBase /site
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
</IfModule>