开发者

How can I get my zend application working as a subdirectory of a domain?

开发者 https://www.devze.com 2023-04-11 11:18 出处:网络
I have a domain with ssl (canvas.example.com), and have created a new zend appli开发者_JAVA技巧cation that I want to add to that domain (canvas.example.com/newapp). It is on an apache server. Is this

I have a domain with ssl (canvas.example.com), and have created a new zend appli开发者_JAVA技巧cation that I want to add to that domain (canvas.example.com/newapp). It is on an apache server. Is this possible? I have tried to modify my virtual host, and also played with .htaccess, but no luck. Perhaps some route rules in Zend could get this working, I'm running out of ideas...


Assuming you're using the default Zend_Application .htaccess file:

SetEnv APPLICATION_ENV development

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

You need to tell mod_rewrite what the base directory is, using RewriteBase, like so:

SetEnv APPLICATION_ENV development

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

(Where this file goes in the same directory as your index.php)

This is the only zend specific thing going on; everything else should be just as configuring a vhost in apache.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号