Searching over the web I could’n find a working solution for the following problem:
- I need one domain with seo friendly urls
- access same controller with the following patterns:
example: domain/en/introduction, domain/de/vorstellung, domain/hu/bemutatkozas, etc.
but domain/de/introduction can’t be called because of duplicate content
- ability to generate correct url with language code using createUrl
Anyone having the same problem? Please share the solution for me!
“domain/de/introduction can’t be called because of duplicate content” why not?
your controller should be call the appropriate view according to language
Why you want to change both lang and controller’s name in url ?
I need to have completely different and unique urls for languages
en/introduction -> english introduction page
de/vordtellung -> deutsch introduction page
and de/introduction -> must give no result or 404 , anything but the deutsch introduction page
You have to do more custom-dynamic rules for the urlManager
check this extensions
or read relative posts
The easy way (if you not yet create a lot of code)
make rules for urlmanager like that ‘<lang>/<slug:[\w\-]+>’=>‘site/index’,
in action index you can manipulate everything you want!
If I am right, in this case You are saying that I need to have only one index action in the site controller which will render different views based on the slug and language.
Right, This is one way to do that.
Tips: you could make a mapping slugs and internal ‘actions’. for example
$slugaction = array (
call_user_func(array($this, $slugaction[$selectedIndex]), yourArrayParams);
Another way is making dynamically urlManager rules