1

I'm trying to define a language route working with an existing route. The idea is to make work the following urls:

/en/dashboard/usability-testing/setup
/fr/dashboard/usability-testing/setup

The problem is that they only work without the language (/dashboard/usability-testing/setup) and of course always default to english.

Here is my application.ini routes definition:

resources.router.routes.defaultmodule.type = Zend_Controller_Router_Route_Module
resources.router.routes.defaultmodule.defaults.mod ule = "default"

resources.router.routes.testing.type = Zend_Controller_Router_Route
resources.router.routes.testing.route = "dashboard/usability-testing/:action/*"
resources.router.routes.testing.defaults.controlle r = "usability-testing"
resources.router.routes.testing.defaults.action = "index"

resources.router.routes.study.type = Zend_Controller_Router_Route
resources.router.routes.study.route = "dashboard/usability-study/:action/*"
resources.router.routes.study.defaults.controller = "usability-study"
resources.router.routes.study.defaults.action = "index"

resources.router.routes.language.type = Zend_Controller_Router_Route
resources.router.routes.language.route = ":language"
resources.router.routes.language.reqs.language = "^(ca|es|en|fr)$"
resources.router.routes.language.defaults.language = "en"
resources.router.routes.language.chain = "testing, study, defaultmodule"

resources.router.routes.default.type = Zend_Controller_Router_Route_Chain
resources.router.routes.default.chain = "language, defaultmodule"

Could anybody help? Thanks @avergess

1 Answers1

0

Maybe in this case you need to solve your problem using something like Apache .htaccess or at least routing using the web server and not Zend_Route.

I saw that when you have more complicated and bigger rulesets, it's better to use apache for that as it is quicker and faster than doing the same in PHP.

You need to add rules for each language. You need to know, using domain.com/lang is not the best option. Matt Cutts suggests using the domain for country or subdomain, if you use subdomain (lang.domain.com), your problem could be solved with out Apache RewriteRules.

James Butler
  • 3,852
  • 1
  • 26
  • 38
Pablo Morales
  • 687
  • 1
  • 5
  • 15
  • http://googlewebmastercentral.blogspot.com/2010/03/working-with-multi-regional-websites.html – Pablo Morales Jan 04 '12 at 14:39
  • 1
    Thanks for your answer. Then, do you think is not possible to do that with Zend_Route? Unfortunately, change the language route (domain.com/lang) at this moment, is not an option – Aleix Vergés Jan 04 '12 at 20:51
  • Yes, maybe you can do that, but I don't believe be a good Idea. I think your best option is write all rules, for all countries. – Pablo Morales Jan 04 '12 at 20:56
  • Hi again, just for the record, here is the solution I found http://forums.zend.com/viewtopic.php?f=69&t=43873 .Thanks for your help – Aleix Vergés Jan 07 '12 at 20:58