# CakePHP 3 controller language change in url

**URL:** <https://discourse.cakephp.org/t/cakephp-3-controller-language-change-in-url/1785>\
**Category:** Need Help\
**Tags:** translation, i18n\
**Created:** [December 29, 2016, 4:49pm UTC](https://discourse.cakephp.org/t/cakephp-3-controller-language-change-in-url/1785 "2016-12-29T16:49:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![maiteakt](https://avatars.discourse-cdn.com/v4/letter/m/c5a1d2/32.png) [@maiteakt](https://discourse.cakephp.org/u/maiteakt)\
**Post date:** [December 29, 2016, 4:49pm UTC](https://discourse.cakephp.org/t/cakephp-3-controller-language-change-in-url/1785/1 "2016-12-29T16:49:03Z")

</div>

Hello,

I am new in CakePHP and I have started making a new multi language website with CakePHP 3. I would like to change the URL depending on the language (For the SEO). For example, I have two languages : spanish and english.  
In the controller “Users” I’ve got an action called: add.

So, depending on the language, it would be:

Spanish:  
[www.example.com/es/usuarios/crear](http://www.example.com/es/usuarios/crear)

English:  
[www.example.com/en/users/add](http://www.example.com/en/users/add)

My question is: Is there any chance in CakePHP 3 to change the controllers and actions language in the url?

Thanks!

---

<div class="post-metadata">

**Author:** ![ADmad](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/admad/32/20_2.png) [@ADmad](https://discourse.cakephp.org/u/ADmad)\
**Post date:** [December 29, 2016, 6:21pm UTC](https://discourse.cakephp.org/t/cakephp-3-controller-language-change-in-url/1785/2 "2016-12-29T18:21:35Z")

</div>

> **[ADmad/cakephp-i18n](https://github.com/admad/cakephp-i18n#i18nroute)**
>
> A CakePHP plugin with I18n related tools. Contribute to ADmad/cakephp-i18n development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![jerome.oneil](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/jerome.oneil/32/376_2.png) [@jerome.oneil](https://discourse.cakephp.org/u/jerome.oneil)\
**Post date:** [December 30, 2016, 12:36am UTC](https://discourse.cakephp.org/t/cakephp-3-controller-language-change-in-url/1785/3 "2016-12-30T00:36:21Z")

</div>

Use the router to configure the routes in the languages you want, and direct them to the appropriate controller.

`Router::connect('usuarios/crear', ['controller' => 'Users', 'action' => 'add']);`

---

<div class="post-metadata">

**Author:** ![maiteakt](https://avatars.discourse-cdn.com/v4/letter/m/c5a1d2/32.png) [@maiteakt](https://discourse.cakephp.org/u/maiteakt)\
**Post date:** [January 3, 2017, 4:12pm UTC](https://discourse.cakephp.org/t/cakephp-3-controller-language-change-in-url/1785/4 "2017-01-03T16:12:15Z")

</div>

Thank you so much! I have installed the plugin and the languages work fine! But I have a question: Is possible to change the controllers language in the url with the plugin?

Thank you so much!

---

<div class="post-metadata">

**Author:** ![ADmad](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/admad/32/20_2.png) [@ADmad](https://discourse.cakephp.org/u/ADmad)\
**Post date:** [January 4, 2017, 6:51pm UTC](https://discourse.cakephp.org/t/cakephp-3-controller-language-change-in-url/1785/5 "2017-01-04T18:51:34Z")

</div>

> [@maiteakt](#):
>
> Is possible to change the controllers language in the url with the plugin?

Not sure what you mean. With the `I18nRoute` provided in the plugin you can language based URLs like `/en/controller/action`, `/fr/controller/action` etc.
