-- Jim Scherer <[EMAIL PROTECTED]> wrote
(on Thursday, 21 June 2007, 11:41 AM -0700):
> I'm a Dreamhost hosting user and I am having routing problems too. I've
> hacked Zend_Controller_Request_Http public function setRequestUri to resolve
> my issue and have posted a question about it here
> http://www.nabble.com/Zend_Controller_Request_Http-setRequestUri-bug--tf3953464s16154.html
> 
> My hack is to flip the 1st and 2nd elseif condition so that
> $_SERVER['REDIRECT_URI'] is checked before $_SERVER['REDIRECT_URL']. 
> 
> public function setRequestUri($requestUri = null)
>     {
>         if ($requestUri === null) {
>             if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { // check this first
> so IIS will catch
>                 $requestUri = $_SERVER['HTTP_X_REWRITE_URL'];
> ==>       } elseif (isset($_SERVER['REQUEST_URI'])) {
> ==>           $requestUri = $_SERVER['REQUEST_URI'];
> ==>       } elseif (isset($_SERVER['REDIRECT_URL'])) {  // Check if using
> mod_rewrite
> ==>           $requestUri = $_SERVER['REDIRECT_URL'];

This is interesting. The check for redirect_url was added recently for
those who are using apache's 404 handling to route requests, or using
the passthrough (PT) flag in one mod_rewrite rule to pass to another.

The problem is that if we flip-flop the checks, then using 404 handling
or multiple rewrite rules would pose issues.

What is the value of REDIRECT_URL? is it empty? or another value? Could
one of you experiencing the issue give me a list of the following:

    * Actual requested URI
    * value of $_SERVER['REDIRECT_URL']
    * value of $_SERVER['REQUEST_URI']

That may help me diagnose the issue better.

Thanks!

>             } elseif (isset($_SERVER['ORIG_PATH_INFO'])) { // IIS 5.0, PHP
> as CGI
>                 $requestUri = $_SERVER['ORIG_PATH_INFO'];
>                 if (!empty($_SERVER['QUERY_STRING'])) {
>                     $requestUri .= '?' . $_SERVER['QUERY_STRING'];
>                 }
>             } else {
>                 return $this;
>             }
>         } elseif (!is_string($requestUri)) {
>             return $this;
>         } else {
>             // Set GET items, if available
>             $_GET = array();
>             if (false !== ($pos = strpos($requestUri, '?'))) {
>                 // Get key => value pairs and set $_GET
>                 $query = substr($requestUri, $pos + 1);
>                 parse_str($query, $vars);
>                 $_GET = $vars;
>             }
>         }
>          
>         $this->_requestUri = $requestUri;
>         return $this;
>     }
> 
> I'm not sure if this is the solution for your problem. But if you are stuck,
> this maybe worth a try.
> 
> Jim
> 
> 
> alesl wrote:
> > 
> > Hi.
> > 
> > When testing a Zend Framework application at Dreamhost hosting, I
> > discovered a problem with the routing system in my particular
> > configuration. 
> > At home everything works perfectly (tested on windows and linux -
> > apache_mod), but routing does not work correctly in environmet with
> > Apache, suexec and mod_rewrite (Dreamhost).
> > 
> > This is my .htaccess
> > RewriteEngine on
> > 
> > RewriteBase /
> > 
> > RewriteCond %{SCRIPT_FILENAME} !-f
> > RewriteCond %{SCRIPT_FILENAME} !-d
> > RewriteRule ^(.*)$ index.php/$1 [L]
> > 
> > RewriteCond %{REQUEST_FILENAME} -f
> > RewriteRule ^(.*\.)(js|css)$ index.php [L,NC]
> > 
> > The second conditon rewrites js and css files to index.php where front
> > controller takes action with defined route:
> > routes.jscss.type                      = 
> > "Zend_Controller_Router_Route_Regex"
> > routes.jscss.route                     = "(.+)\.(css|js)"
> > routes.jscss.defaults.module               = "jscss"
> > routes.jscss.defaults.controller    = "index"
> > routes.jscss.defaults.action                = "index"
> > routes.jscss.map.1                    = "file" 
> > routes.jscss.map.2                    = "type" 
> > 
> > Ass i said on local machines js, css files are minimized and send back to
> > browser. On Dreamhost nothing hapens -> routing is ignored ?!?!
> > 
> > Any sugestions??
> > 
> > Regards, AlesL
> > 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/Routing-does-not-work-correctly-tf3960104s16154.html#a11239120
> Sent from the Zend Framework mailing list archive at Nabble.com.
> 

-- 
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to