Ronak Modi
Ronak Modi

Reputation: 57

Check Zend Registry variable inside htaccess?

I want to write htaccess redirect rule on the base of value inside Zend_Registry variable

Something like this

if(Zend_Registry::get('country') == 'uk'){

     RewriteRule (.+).html /abc/page/directory/abc/view/$1 [L]

}elseif(Zend_Registry::get('country') == 'ca'){

     RewriteRule (.+).html /xyz/static/directory/xyz/view/$1 [L]
}

Thank You in adavance.

Upvotes: 2

Views: 61

Answers (1)

David Weinraub
David Weinraub

Reputation: 14184

Sorry to be the bearer of bad news, but you can't do what you are asking. When Apache serves the page, it consults .htaccess before it hands off to the PHP processor, inside of which your application (and Zend_Registry) resides.

You need to handle all this inside the app using ZF's standard routing.

If, however, your country values are detectable from the host name or from the requested url itself, then you can use standard .htaccess RewriteRules, no Zend_Registry involved or required.

Upvotes: 2

Related Questions