# Add dynamic prefix into url

**URL:** <https://discourse.cakephp.org/t/add-dynamic-prefix-into-url/459>\
**Category:** Need Help\
**Created:** [June 4, 2016, 11:26am UTC](https://discourse.cakephp.org/t/add-dynamic-prefix-into-url/459 "2016-06-04T11:26:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anyway111](https://avatars.discourse-cdn.com/v4/letter/a/f08c70/32.png) [@anyway111](https://discourse.cakephp.org/u/anyway111)\
**Post date:** [June 4, 2016, 11:26am UTC](https://discourse.cakephp.org/t/add-dynamic-prefix-into-url/459/1 "2016-06-04T11:26:50Z")

</div>

Dear guys,

I want to add dynamic prefix into url

How do it by cakephp, please?

Sorry if i have post mistake.

Example:  
when user choose location en-us or ja-jp. url or category-machine, category-sport became as bellow

[xxx.com/en-us/category-machine/ads/](http://xxx.com/en-us/category-machine/ads/)  
[xxx.com/ja-jp/category-sport/ads/](http://xxx.com/ja-jp/category-sport/ads/)

---

<div class="post-metadata">

**Author:** ![lorenzo](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/lorenzo/32/25_2.png) [@lorenzo](https://discourse.cakephp.org/u/lorenzo)\
**Post date:** [June 4, 2016, 1:44pm UTC](https://discourse.cakephp.org/t/add-dynamic-prefix-into-url/459/2 "2016-06-04T13:44:22Z")

</div>

What version of CakePHP?

---

<div class="post-metadata">

**Author:** ![mehdifathi](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/mehdifathi/32/241_2.png) [@mehdifathi](https://discourse.cakephp.org/u/mehdifathi)\
**Post date:** [June 5, 2016, 4:33am UTC](https://discourse.cakephp.org/t/add-dynamic-prefix-into-url/459/3 "2016-06-05T04:33:29Z")

</div>

I didn’t do it.but i think you can do it.You must load model on route and generate prefix with all fields on your Model.that is hard.I don’t know what is good way.search in github maybe you will find a plugin or component.good luck

---

<div class="post-metadata">

**Author:** ![anyway111](https://avatars.discourse-cdn.com/v4/letter/a/f08c70/32.png) [@anyway111](https://discourse.cakephp.org/u/anyway111)\
**Post date:** [June 5, 2016, 3:03pm UTC](https://discourse.cakephp.org/t/add-dynamic-prefix-into-url/459/4 "2016-06-05T15:03:29Z")

</div>

thank you for reading,  
I’m using cakephp 3.2

---

<div class="post-metadata">

**Author:** ![anyway111](https://avatars.discourse-cdn.com/v4/letter/a/f08c70/32.png) [@anyway111](https://discourse.cakephp.org/u/anyway111)\
**Post date:** [June 5, 2016, 3:04pm UTC](https://discourse.cakephp.org/t/add-dynamic-prefix-into-url/459/5 "2016-06-05T15:04:37Z")

</div>

thank for reading,  
i have searched on github but have not plugin,  
you can write some simple demo to do it?

---

<div class="post-metadata">

**Author:** ![chav170](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/chav170/32/91_2.png) [@chav170](https://discourse.cakephp.org/u/chav170)\
**Post date:** [June 6, 2016, 9:35am UTC](https://discourse.cakephp.org/t/add-dynamic-prefix-into-url/459/6 "2016-06-06T09:35:30Z")

</div>

This plugin should do what you need:  
[https://github.com/CakeDC/i18n](https://github.com/CakeDC/i18n)

**Updated** : Did not notice the Cakephp version, for Cake 3 check:

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

---

<div class="post-metadata">

**Author:** ![anyway111](https://avatars.discourse-cdn.com/v4/letter/a/f08c70/32.png) [@anyway111](https://discourse.cakephp.org/u/anyway111)\
**Post date:** [June 6, 2016, 12:51pm UTC](https://discourse.cakephp.org/t/add-dynamic-prefix-into-url/459/7 "2016-06-06T12:51:28Z")

</div>

thank guys  
i will try it now
