Hello,
I am playing with Zend 1.9 and would like to have the language parameter as subdomain.
Like : http://en.site.com
Is it possible to get the language in .htaccess and set it to an environment variable which I can use in Zend ?
What is the best way to achieve what I want ?
-- added --:
I added this into my routes.ini :
[routes]
routes.lif.type = "Zend_Controller_Router_Route_Hostname"
routes.lif.route = ":language.domain.:tld"
routes.lif.reqs.language= "[a-z]{2}"
routes.lif.defaults.controller = "index"
routes.lif.defaults.action = "index"
routes.lif.defaults.language = "en"
; default
routes.lif.chains.default.type = "Zend_Controller_Router_Route"
routes.lif.chains.default.route = "/:controller/:action"
routes.lif.chains.default.defaults.controller = index
routes.lif.chains.default.defaults.action = index
; register
routes.lif.chains.register.type = "Zend_Controller_Router_Route"
routes.lif.chains.register.route = "/register"
routes.lif.chains.register.defaults.controller = "register"
routes.lif.chains.register.defaults.action = "newuser"
; details
routes.lif.chains.band.type = "Zend_Controller_Router_Route"
routes.lif.chains.band.route = "/details/:name"
routes.lif.chains.band.defaults.controller = "details"
routes.lif.chains.band.defaults.action = "getdetails"
This is working well if I go to : http://en.domain.com/details/joe But unfortunatly if I remove subdomain : http://domain.com/details/joe the default action is not called and I get
Message: Action "joe" does not exist and was not trapped in __call()
Do you have an idea ?
Thanks guys.
Thierry