PDA

View Full Version : Apache mod_rewrite with Zend Framework



steve_c
February 4th, 2011, 09:37 PM
I've developed an application with Zend Framework on our development server, which uses the User Directories apache mod to give each developer their own web space.

I'm now in the process of trying to move this to our production server. Unfortunately this seems to be causing an error. Pulling up the initial page works fine, but trying to click any of the links generated by Zend_Navigation pulls up the page but not the stylesheet. The server now apparently insists on displaying the index.php file which was hidden on the development server. Even when clicking on other pages (controller/views), it the URL is http://base.url/index.php/controller2/

I feel like this has to be something to do with mod_rewrite on the production server but I'm not sure where or how to change it. I've been through the config and don't see anything that looks like it would be causing it.

Thanks for any help!

Here is a sample line from my access.log if it's any help:

[04/Feb/2011:12:46:14 -0500] "GET /index.php/css/main.css HTTP/1.1" 404 1490 "http://host/index.php/" "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.10 (maverick) Firefox/3.6.13 FirePHP/0.5"


Ok, one thing I've learned is that for some reason on the dev server I cannot prefix any images or css relative URIs with a / (e.g., <img src="images/foo.jpg" /> and prependStylesheet('css/main.css') ) whereas the production server requires the / prefix (e.g., <img src="/images/foo.jpg" /> and prependStylesheet('/css/main.css') ).

Changing that on the production server gets my CSS and my images back, however the annoying "index.php" still shows up in the browser URL for all controllers. I double-checked the rewrite rules on my .htaccess and they are same as before.