重写 htaccess 擦除字符串


Rewrite htaccess erase a string

我想从URL中删除字符串:

http://www.example.com/wp/post-id/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+my-feed-example+%28feedexample.com+escape+this+string+now%29&utm_content=FeedBurner

自:

http://www.example.com/test/post-number/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+my-feed-example+&utm_content=FeedBurner

我想删除这个字符串:

%28feedexample.com+escape+this+string+now%29

post-id超过 1000(帖子),所以我无法手动重定向 (301) 我的所有链接。

可能吗?以及如何?

通过httpd.conf启用mod_rewrite.htaccess,然后将此代码放在.htaccess DOCUMENT_ROOT目录下:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}'s/+(wp/post-id/'?.*?utm_campaign=.*?)'%28feedexample'.com'+escape'+this'+string'+now'%29([^'s]+)'s [NC]
RewriteRule ^ /%1%2 [L,R=301,NE]