301 htaccss redirection using wildcards

Hello,

i need your help to redirect the following

www.mysite.com/forum/showpost.php?p=forum/334362&postcount=8 to www.mysite.com/forum/showpost.php?p=334362&postcount=8

Thank you.

May be you try this

RewriteCond %{QUERY_STRING} p=forum/(.*?)\\&postcount=(.*)
RewriteRule showpost.php /forum/showpost.php?p=%1&postcount=%2 [R=301,L]

Hai tamilsuresh

Thank you!
i really forogot to mention that some part of url is dynamic and you spoted that :smiley:

Hope my solution solved your problem, mark the post as solved :slight_smile:

Gentlemen,

Please note that the & in the query string regex need not (should not) be escaped. Since the query’s values are digital, I’d also use ([0-9]+) for both atoms rather than (.?) and (.) … let mod_rewrite do some error checking for you!

Regards,

DK