# Custom permalinks

**URL:** https://meta.discourse.org/t/custom-permalinks/56867
**Category:** Support
**Created:** [February 3, 2017, 3:41pm UTC](https://meta.discourse.org/t/custom-permalinks/56867 "2017-02-03T15:41:38Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![hnaseri](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hnaseri/32/120660_2.png) [@hnaseri](https://meta.discourse.org/u/hnaseri)
#### Post date: [February 3, 2017, 3:41pm UTC](https://meta.discourse.org/t/custom-permalinks/56867/1 "2017-02-03T15:41:38Z")

</div>

There is a permalink tab under customize section in admin panel. I don’t know what does it exactly do. Can someone please explain it to me with a picture from that area? Because I have my discourse in Persian, and Persian translation of different fields in this section doesn’t make sense to me.

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [February 3, 2017, 5:37pm UTC](https://meta.discourse.org/t/custom-permalinks/56867/2 "2017-02-03T17:37:36Z")

</div>

See:

> [@What do Permalinks under Customize do?](https://meta.discourse.org/t/what-do-permalinks-under-customize-do/31783/2):
>
> They are mostly used for people who migrate from other forum software. The idea of a permalink is you can create a link on discourse that will resolve to a particular topic or category. Your link could be /hello-world instead of /t/12345/hello-world.

and

> [@Redirect old forum URLs to new Discourse URLs using permalinks](https://meta.discourse.org/t/redirecting-old-forum-urls-to-new-discourse-urls/20930):
>
> Redirecting Old Forum URLs to New Discourse URLs using permalinks If you’ve moved from other forum software to Discourse using [one of our import scripts](https://github.com/discourse/discourse/tree/main/script/import_scripts), then you probably want all your hard-earned Google search results to continue pointing to the same content. Discourse has a built-in way to handle this for you as an alternative to writing nginx rules, using the permalinks lookup table. The permalinks table allows you to set two things: a url to match, and what that url should show. There a…

---

<div class="post-metadata">

### Author: ![hnaseri](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hnaseri/32/120660_2.png) [@hnaseri](https://meta.discourse.org/u/hnaseri)
#### Post date: [February 3, 2017, 6:41pm UTC](https://meta.discourse.org/t/custom-permalinks/56867/3 "2017-02-03T18:41:11Z")

</div>

thanks.  
How can I programmatically create these permalinks? php code is preferred for me. is it possible?

I want to use discourse as a q&a platform in my educational app. My app has a structure like this:  
`course/chapter/lesson`  
So I want the users to be able to create new topics like this:  
`course/chapter/lesson/topic-1`  
`course/chapter/lesson/topic-2`  
etc…  
since this structure isn’t supported by discourse, I want to use this customized permalinks as a redirection tool to created topics. Is it a good idea?

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [February 3, 2017, 6:45pm UTC](https://meta.discourse.org/t/custom-permalinks/56867/4 "2017-02-03T18:45:01Z")

</div>

You can use the API to create these. Create a permalink while the Network tab of your browser’s development tools is open to see how it works. You can find more details here:

> [@Reverse engineer the Discourse API](https://meta.discourse.org/t/how-to-reverse-engineer-the-discourse-api/20576):
>
> Discourse is backed by a complete JSON api. Anything you can do on the site you can also do using the JSON api. The API is documented at [docs.discourse.org](https://docs.discourse.org). You can also use the [discourse\_api](https://github.com/discourse/discourse_api) Ruby gem as a client library. However, not every endpoint is documented. To determine how to do something with the JSON API here are some steps you can follow. Example: recategorize a topic. Go to a topic and start editing a category: Open Chrome dev tools, switch to the Network tab, select …

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [February 3, 2017, 9:18pm UTC](https://meta.discourse.org/t/custom-permalinks/56867/5 "2017-02-03T21:18:05Z")

</div>

> [@hnaseri](#):
>
> How can I programmatically create these permalinks?

There’s a post in the linked topic with an example:

[https://meta.discourse.org/t/redirecting-old-forum-urls-to-new-discourse-urls/20930/16?u=neil](https://meta.discourse.org/t/redirecting-old-forum-urls-to-new-discourse-urls/20930/16)

```plaintext
Permalink.create(url: '/discussion/12345', topic_id: 987)

```

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [March 7, 2020, 6:30pm UTC](https://meta.discourse.org/t/custom-permalinks/56867/12 "2020-03-07T18:30:49Z")

</div>



---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [March 7, 2020, 8:16pm UTC](https://meta.discourse.org/t/custom-permalinks/56867/13 "2020-03-07T20:16:41Z")

</div>

#faq-material for this should be developed as part of [Feature interest survey: "go" permalinks](https://meta.discourse.org/t/feature-interest-survey-go-permalinks/142605)

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [March 7, 2020, 8:16pm UTC](https://meta.discourse.org/t/custom-permalinks/56867/14 "2020-03-07T20:16:50Z")

</div>


