Searching over the web I could’n find a working solution for the following problem:
I need one domain with seo friendly urls
example: domain_name/language_code/translated_controller_name
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!
Thanks.
konapaz
(Konapaz)
November 29, 2013, 10:19am
2
Hi
“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 ?
KonApaz:
Hi
“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
konapaz
(Konapaz)
November 29, 2013, 11:59am
4
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
http://www.yiiframework.com/extension/slug-behavior/
http://www.yiiframework.com/extension/yiibehaviorsluggable/
or read relative posts
http://www.yiiframework.com/forum/index.php/topic/46604-migrate-drupal-seo-urls/page__p__218967__fromsearch__1
http://www.yiiframework.com/forum/index.php/topic/22551-urlmanager-how-do-i-use-my-own-urls-stored-in-database/
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.
konapaz
(Konapaz)
December 2, 2013, 10:58am
6
Right, This is one way to do that.
Tips: you could make a mapping slugs and internal ‘actions’. for example
$slugaction = array (
'a-slug'=>'func1'
'b-slug'=>'func2'
'c-slug'=>'func3'
)
call_user_func(array($this, $slugaction[$selectedIndex]), yourArrayParams);
Another way is making dynamically urlManager rules