# Another permalink question - using a regex

**URL:** https://meta.discourse.org/t/another-permalink-question-using-a-regex/336603
**Category:** Support
**Created:** [November 17, 2024, 2:31pm UTC](https://meta.discourse.org/t/another-permalink-question-using-a-regex/336603 "2024-11-17T14:31:07Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![francis\_exalate](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/francis_exalate/32/461390_2.png) [@francis\_exalate](https://meta.discourse.org/u/francis_exalate)
#### Post date: [November 17, 2024, 2:31pm UTC](https://meta.discourse.org/t/another-permalink-question-using-a-regex/336603/1 "2024-11-17T14:31:07Z")

</div>

Hi,

Whenever I search on google for topics that have been on the old community but have been migrated, google returns something like

 ![Google Chrome 2024-11-17 15.28.09](https://global.discourse-cdn.com/meta/original/4X/2/1/f/21f86d6c6daff965550bdf989a7ce8dbf05af39d.png)

Of course all these links lead to a 404 because the path [Welcome to the new Exalate community - Site Feedback - Exalate](http://community.exalate.com/questions) doesn’t exist

Is there a way to add a regexp to the permalinks, such that whenever someone searches for

```plaintext
https://community.exalate.com/questions/20123204/stop-syncing

```

The request is automatically redirected to a topic/wiki page explaining the situation?

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [November 17, 2024, 5:35pm UTC](https://meta.discourse.org/t/another-permalink-question-using-a-regex/336603/2 "2024-11-17T17:35:19Z")

</div>

I _think_ the best way to do this is with a [Permalink Normalisation](https://meta.discourse.org/t/redirect-old-forum-urls-to-new-discourse-urls/20930)

(i.e. strip off everything after /questions then add a Permalink for that path)

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [November 17, 2024, 7:05pm UTC](https://meta.discourse.org/t/another-permalink-question-using-a-regex/336603/3 "2024-11-17T19:05:57Z")

</div>

Did you import /20123204/stop-syncing? If so, and you did it with something that used the import script base.rb then you should be able to make those go the right place

---

<div class="post-metadata">

### Author: ![francis\_exalate](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/francis_exalate/32/461390_2.png) [@francis\_exalate](https://meta.discourse.org/u/francis_exalate)
#### Post date: [November 17, 2024, 7:09pm UTC](https://meta.discourse.org/t/another-permalink-question-using-a-regex/336603/4 "2024-11-17T19:09:14Z")

</div>

No idea what import base.rb is.

All these topics have been imported using the API.  
Can you give a pointer for details?

Thanks!

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [November 17, 2024, 7:23pm UTC](https://meta.discourse.org/t/another-permalink-question-using-a-regex/336603/5 "2024-11-17T19:23:49Z")

</div>

> [@francis\_exalate](#):
>
> All these topics have been imported using the API.

Oh. Then you don’t have import\_id; that’s one more reason that imports with the API are a bad idea.

You’d need to create permalinks (admin /customize/permalinks) for the posts you imported. But you could use a single permalink redirect to catch them all and point them to a single place.

---

<div class="post-metadata">

### Author: ![francis\_exalate](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/francis_exalate/32/461390_2.png) [@francis\_exalate](https://meta.discourse.org/u/francis_exalate)
#### Post date: [November 17, 2024, 7:24pm UTC](https://meta.discourse.org/t/another-permalink-question-using-a-regex/336603/6 "2024-11-17T19:24:07Z")

</div>

Hi,

I added

‘questions,’ pointing to a topic but that doesn’t resolve it.

To be honest, the ‘permalink normalization’ description is exceeding my intellectual capacity to understand 😓 so probably I’m missing the point.

What should I enter in the permalink interface so that any request to …/questions/… gets mapped to a single topic?

---

<div class="post-metadata">

### Author: ![francis\_exalate](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/francis_exalate/32/461390_2.png) [@francis\_exalate](https://meta.discourse.org/u/francis_exalate)
#### Post date: [November 17, 2024, 7:25pm UTC](https://meta.discourse.org/t/another-permalink-question-using-a-regex/336603/7 "2024-11-17T19:25:41Z")

</div>

Alright, our posts crossed.  
What is the magic to get that working?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [November 17, 2024, 7:49pm UTC](https://meta.discourse.org/t/another-permalink-question-using-a-regex/336603/8 "2024-11-17T19:49:07Z")

</div>

Something like

`/question\/.*/your-url`

---

<div class="post-metadata">

### Author: ![yigit](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/yigit/32/350861_2.png) [@yigit](https://meta.discourse.org/u/yigit)
#### Post date: [November 18, 2024, 9:32am UTC](https://meta.discourse.org/t/another-permalink-question-using-a-regex/336603/9 "2024-11-18T09:32:11Z")

</div>



---

<div class="post-metadata">

### Author: ![yigit](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/yigit/32/350861_2.png) [@yigit](https://meta.discourse.org/u/yigit)
#### Post date: [November 18, 2024, 9:32am UTC](https://meta.discourse.org/t/another-permalink-question-using-a-regex/336603/10 "2024-11-18T09:32:28Z")

</div>



---

<div class="post-metadata">

### Author: ![yigit](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/yigit/32/350861_2.png) [@yigit](https://meta.discourse.org/u/yigit)
#### Post date: [November 18, 2024, 9:32am UTC](https://meta.discourse.org/t/another-permalink-question-using-a-regex/336603/11 "2024-11-18T09:32:33Z")

</div>



---

<div class="post-metadata">

### Author: ![yigit](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/yigit/32/350861_2.png) [@yigit](https://meta.discourse.org/u/yigit)
#### Post date: [November 18, 2024, 9:32am UTC](https://meta.discourse.org/t/another-permalink-question-using-a-regex/336603/12 "2024-11-18T09:32:50Z")

</div>



---

<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: [November 18, 2024, 9:32am UTC](https://meta.discourse.org/t/another-permalink-question-using-a-regex/336603/13 "2024-11-18T09:32:50Z")

</div>



---

<div class="post-metadata">

### Author: ![yigit](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/yigit/32/350861_2.png) [@yigit](https://meta.discourse.org/u/yigit)
#### Post date: [November 18, 2024, 9:36am UTC](https://meta.discourse.org/t/another-permalink-question-using-a-regex/336603/14 "2024-11-18T09:36:04Z")

</div>

Hi Francis 👋 I’ve converted this into a private message with our support inbox. In the future, you can send a PM to `team` directly or email [team@discourse.org](mailto:team@discourse.org) for requests like this.

It seems that you already got support from the community 🙂 but if you need any further information or help please do let us know.

---

<div class="post-metadata">

### Author: ![francis\_exalate](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/francis_exalate/32/461390_2.png) [@francis\_exalate](https://meta.discourse.org/u/francis_exalate)
#### Post date: [November 18, 2024, 11:47am UTC](https://meta.discourse.org/t/another-permalink-question-using-a-regex/336603/15 "2024-11-18T11:47:33Z")

</div>

Ok, thanks for letting me know.

---

<div class="post-metadata">

### Author: ![francis\_exalate](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/francis_exalate/32/461390_2.png) [@francis\_exalate](https://meta.discourse.org/u/francis_exalate)
#### Post date: [November 18, 2024, 11:49am UTC](https://meta.discourse.org/t/another-permalink-question-using-a-regex/336603/16 "2024-11-18T11:49:40Z")

</div>

Hi yigit

I don’t have a solution yet.  
When I try questions/.\* as source url, requests to [community.exalate.com/questions/blah](http://community.exalate.com/questions/blah) are not redirected.

Is there something I need to take into account.

---

<div class="post-metadata">

### Author: ![yigit](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/yigit/32/350861_2.png) [@yigit](https://meta.discourse.org/u/yigit)
#### Post date: [November 18, 2024, 3:56pm UTC](https://meta.discourse.org/t/another-permalink-question-using-a-regex/336603/17 "2024-11-18T15:56:11Z")

</div>

Oh okay. Thank you for letting us know Francis.

I’ve tried some combinations, but I can’t manage to get the expected results so far. Let me consult internally to find out an applicable option. We will get back to you as soon as possible once we have an update for you. 👍

---

<div class="post-metadata">

### Author: ![francis\_exalate](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/francis_exalate/32/461390_2.png) [@francis\_exalate](https://meta.discourse.org/u/francis_exalate)
#### Post date: [November 18, 2024, 4:39pm UTC](https://meta.discourse.org/t/another-permalink-question-using-a-regex/336603/19 "2024-11-18T16:39:15Z")

</div>

Lily is also working the case …

> **···**
>
> On Mon, Nov 18, 2024, 16:57 Discourse Team \<[team@discourse.org](mailto:team@discourse.org)\> wrote:
> 
> > ## Please type your reply above this line.
> > 
> > > ![](https://global.discourse-cdn.com/meta/original/4X/e/b/e/ebe11d95da14cc3196b17c61dca92e426311c4a6.png "yigit") | [Yiğit Mersin](https://meta.discourse.org/u/yigit) yigit team  
> > > November 18 |
> > > 
> > > - | - |
> > 
> > Oh okay. Thank you for letting us know Francis.
> > 
> > I’ve tried some combinations, but I can’t manage to get the expected results so far. Let me consult internally to find out an applicable option. We will get back to you as soon as possible once we have an update for you. ![:+1:](https://emoji.discourse-cdn.com/twitter/+1.png?v=12 ":+1:")
> > 
> > * * *
> > 
> > Reply to this email to respond to [Discourse Team (98)](https://meta.discourse.org/g/team).
> 
> [Legal Disclaimer](https://exalate.com/email-legal-disclaimer/)

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [November 18, 2024, 11:52pm UTC](https://meta.discourse.org/t/another-permalink-question-using-a-regex/336603/20 "2024-11-18T23:52:42Z")

</div>

Hi Francis,

The normalizations are an advanced feature in a different spot - I only knew about them and hadn’t used them myself yet. They’re in site settings, not in the Permalink interface.

Try this:

- add a normalization of `/questions\/.*/questions` to the `permalink normalizations` site setting  
 ![This image appears to be a screenshot of a web browser with a URL bar, likely used for testing or demonstrating a specific functionality. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/2/b/f/2bf1cfd9e56cc957102e3ab7d49147c8c7c97554.png)
- add a permalink for `/questions`  
 ![This image shows a screenshot from a web-based interface for editing a permalink, which is likely a web page or online content's permanent link. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/1/2/4/124cbec4d51b9fca214d8665dd6ad90ccf1099c0.png)  
 ![The image is a screenshot of a webpage with a white background, featuring a URL bar at the top and a text box labeled "Edit" below it, accompanied by a blue hyperlink that reads "Whoa. Check out this crazy paper artwork". (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/4/c/0/4c0061120c1123f64dfa9a2aa76291d7b5dbbb43.png)

I’ve done this on our demo site [https://try.discourse.org](https://try.discourse.org) and it works as follows:

```plaintext
○ → curl -i https://try.discourse.org/questions/do/you/wanna/build/a/snowman
HTTP/2 301 
…
x-discourse-route: permalinks/show
location: https://try.discourse.org/t/whoa-check-out-this-crazy-paper-artwork/77
…

```

That site will reset overnight (as usual) and that’ll vanish, but this should do what you need on your site.

---

<div class="post-metadata">

### Author: ![francis\_exalate](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/francis_exalate/32/461390_2.png) [@francis\_exalate](https://meta.discourse.org/u/francis_exalate)
#### Post date: [November 19, 2024, 7:14am UTC](https://meta.discourse.org/t/another-permalink-question-using-a-regex/336603/22 "2024-11-19T07:14:56Z")

</div>

Solved.

Hi @pfaffman - I first didn’t get your suggestion, but @supermathie screenshot turned on the light.

Thanks all for the help

[Next page](https://meta.discourse.org/t/another-permalink-question-using-a-regex/336603.md?page=2)
