كيف تعمل تطبيع الرابط الدائم باستخدام regex؟

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/

And the new discourse URL is
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/

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

إعجاب واحد (1)

You don’t need a \2. And you need a \ before the period that you’ure searching for. You’ve got only one thing in parentheses. Maybe something like

/^(/threads/)[^.]+\.(\d+)/?$/threads/\1
إعجاب واحد (1)

/threads\/[^.]+\.([0-9]+)\/?/threads/\1

this worked

3 إعجابات

Hey, im in the same situation and this worked for me! :clinking_beer_mugs:

But when the URL (xenforo URL) has inner pages like for example"https://website[.]com/threads/thread-slug/page-3" then again ill get the " Oops! That page doesn’t exist or is private." error page. Any fix for this?

إعجاب واحد (1)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.