# How does permalink normalization with regex work?

**URL:** <https://meta.discourse.org/t/how-does-permalink-normalization-with-regex-work/354671>\
**Category:** Product Support\
**Created:** [February 26, 2025, 5:36pm UTC](https://meta.discourse.org/t/how-does-permalink-normalization-with-regex-work/354671 "2025-02-26T17:36:46Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![SubStrider](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/substrider/32/512604_2.png) [@SubStrider](https://meta.discourse.org/u/SubStrider)\
**Post date:** [February 26, 2025, 5:36pm UTC](https://meta.discourse.org/t/how-does-permalink-normalization-with-regex-work/354671/1 "2025-02-26T17:36:46Z")

</div>

I went to this setting Admin \> Permalinks \> Settings  
Which says it will apply the regex before matching the permalink.

I have an old xenforo forum URL which is  
[http://localhost/threads/xyz-abc-is-ghp.223846/](http://localhost/threads/xyz-abc-is-ghp.223846/)

And the new discourse URL is  
[http://localhost/t/xyz-abc-is-ghp/274528](http://localhost/t/xyz-abc-is-ghp/274528)

When I enter the xenforo URL in the browser without the slug like the following then it is redirecting fine but not with it.  
[http://localhost/threads/223846/](http://localhost/threads/223846/)

So I tried to use the following regex to strip the slug out but it seems to be doing nothing. Am I missing a step or is this not how its to be done?  
/^(/threads/)[^.]+.(\d+)/?$/+/\1\2

---

_[View the full topic](https://meta.discourse.org/t/how-does-permalink-normalization-with-regex-work/354671)._
