问题原文
原帖链接 · Randomer11 · CC BY-SA 3.0
Looking to redirect all URLs which look similar to this:
https://www.example.com/discussion/topix/random-page-title.133760/posts/1255466/rate?rating=13&_Token=78139%2C1464617730%2Ca42dfb1db7e54b51db1879075650aaf4a3c3323a
to
https://www.example.com/discussion/topix/random-page-title.133760/
Basically removing the following from the URL:
posts/1255466/rate?rating=13&_Token=78139%2C1464617730%2Ca42dfb1db7e54b51db1879075650aaf4a3c3323a
They are parts of an old system.
已采纳解答
原帖链接 · grg · CC BY-SA 4.0
RedirectMatch 301 ^/discussion/topix/(.*)/posts/.*$ /discussion/topix/$1/
(.*) is a capturing group which matches anything preceding ‘posts’.
$1 outputs the capturing group as the destination for the redirect.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
