Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-20-2008, 02:23 AM
Junior Member
 
Join Date: May 2008
Posts: 2
Default RedirectLoop from IndexController

Hello All,
I'm struggling to move an existing and functioning ZF app to a new host. The key problem seems to be that requests for /main/static/ which should be directed to my StaticController are always being routed to my IndexController.

I'm finding that any time I hit the app on the new host a loop of 302 redirects begins. The redirect is generated by the IndexController which routes to a view which redirects to another url in the app-- "/static/"-- which should trigger the StaticController to serve the first page in the app.

Through the use of the echo and exit functions I've discovered the the IndexController is in fact executing repeatedly and the StaticController is not executing at all. The server is running PHP 5.2.3 in CGI mode. Following is the mod_rewrite rule from .htaccess:

RewriteEngine on
RewriteRule !\.(js|ico|gif|jpg|png|css|pdf)$ index.php

Another observation is that the $_SERVER['REQUEST_URI'] variable is empty (not listed in phpinfo()) whereas on the working host this variable returns the original request uri as expected-- "/" for the IndexController and "/static/" for the StaticController. I'm not sure if this is a function of cgi mode nor am I sure if that is the variable used by ZF to select a controller...

I'd really appreciate some help! I'm not really anxious to wade through the framework code to find exactly where the controller is selected but if someone happens to know that would be useful as well. My gut feeling is that some $_SERVER variable used by php to access the original request URL isn't set properly; I can't see anything in phpinfo() containing the original request uri! If that's the case I'm not sure how to workaround it either...

Thanks!
-James
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-21-2008, 04:06 AM
Junior Member
 
Join Date: May 2008
Posts: 2
Default

I tried setting an environment variable from the RewriteRule line in .htaccess as follows but it didn't seem to help and after the first load or two seems to have caused a 500 error (not quite sure why)...

RewriteRule !\.(js|ico|gif|jpg|png|css|pdf)$ index.php [E=REQUEST_URI:%{SCRIPT_URL}]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-21-2008, 02:29 PM
sim sim is offline
Junior Member
 
Join Date: Apr 2008
Posts: 9
Default

Quote:
Originally Posted by jandersen78 View Post
Another observation is that the $_SERVER['REQUEST_URI'] variable is empty (not listed in phpinfo())... I'm not sure if this is a function of cgi mode nor am I sure if that is the variable used by ZF to select a controller...
I would try removing htaccess for testing, then create a controller and view that displays $_SERVER['REQUEST_URI'] and $_SERVER['PHP_SELF'].

Or just list all the server environment variables. They will be different depending on your htaccess configuration. Turn htaccess on again, and check again. If you never see a REQUEST_URI your hosting provider should be able to tell you why. It might be the way that virtual hosting is configured.

A 500 error is pretty general. You'll see it a lot if your htaccess is configured improperly.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 09:01 PM.