我去了这个设置 管理员 > 固定链接 > 设置
它说它将在匹配固定链接之前应用正则表达式。
我有一个旧的 xenforo 论坛 URL,它是
http://localhost/threads/xyz-abc-is-ghp.223846/
新的 discourse URL 是
http://localhost/t/xyz-abc-is-ghp/274528
当我在浏览器中输入不带 slug 的 xenforo URL(如下所示)时,它可以正常重定向,但带 slug 的不行。
http://localhost/threads/223846/
所以我尝试使用以下正则表达式来删除 slug,但它似乎什么也没做。我是否遗漏了某个步骤,或者不是这样做的?
/^(/threads/)[^.]+.(\d+)/?$/+/\1\2
1 个赞
pfaffman
(Jay Pfaffman)
2
你不需要 \2。并且你需要在一个你正在搜索的句点前加上 \。你的括号里只有一个东西。也许可以这样:
/^(/threads/)[^.]+\\.(\\d+)/?$/threads/\1
1 个赞
/threads\\/[^.]+\\.([0-9]+)\\/?/threads/\\1
这奏效了
3 个赞
嘿,我遇到了同样的情况,这个方法对我有效!
但是当URL(xenforo URL)包含内页时,例如“https://website[.]com/threads/thread-slug/page-3”,我仍然会得到“哎呀!该页面不存在或已设为私有。”的错误页面。有什么解决方法吗?
1 个赞
system
(system)
关闭
5
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.