install zend framework without apache virtual host

2020-03-25 07:53发布

问题:

I have my website in /var/www/invent. I have zend-framework in /var/www/invent/library.

Basically what i want is when i access http://localhost/invent to work as if i had a virtual host "invent" defined in apache conf file (like accessing http://invent). How can I achieve this? I have developed my project under windows, having virtual hosts set up but I don't want to continue working like this because i cannot deploy my app on public webhosting services that do not allow me to create virtual hosts. Not to mention that if I deploy an app on a LAN, i need to configure the client's hosts file as well... Please help, this is the most annoying thing with zend (haven't tried other frameworks so far though).

回答1:

Your application document root is wherever you place your index.php file, the locations of the Zend Framework library and your application code are irrelevant.

Provided you've used the BaseUrl helper in your views for static assets (JavaScript, CSS, images) and the Url helper for action links, your application should be very portable in regards to relative path from the web server document root.

Let me know if I'm way off track here. Your question could do with some more details.



回答2:

remove vhost property and go directly to http://localhost/yourproject/public folder. You will need to stay with htaccess mod_rewrite , don't delete mod_rewrite properties in htaccess