简体   繁体   中英

How to setup zend framework website without .htaccess

The setup of my .htaccess

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]

Guys i need your expertise on this one. Advice or idea would be great. What i want to happen is that, i'll remove my .htaccess file and create a index.php to configure everything... Is it possible?

Can you please give some examples. Thank you in advance.

REFERENCE BY : http://www.armando.ws/2009/03/how-to-run-zend-framework-with-no-htaccess-file/

Application Specific Include file

Include conf/extra/httpd-zf.conf

This will allow Apache to add addition configuration settings once Apache is restarted and its a great place to isolate application specific Apache settings.

Now, go ahead an create the include file, “httpd-zf.conf” inside the APACHE_HOME/conf/extra/ directory and place the ReWrite rules which were originally in your .htaccess file into it. Hit save, remove the .htaccess file, and restart Apache. You should see your Zend Framework application running.

Why do this? Speed. Your application must always read the .htaccess file when someone visits the site. Removing this extra layer and placing it into the Web Server itself will reduce the amount of time a page loads.

the rewrite part is part of apache, and as such can only be configured in a way apache understands, so you can use .htaccess or the vhost config file directly. no other way.

the APPLICATION_ENV you could set in your index.php, but its there for a reason. so you dont have to change your code in different stagings/installation of your app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM