Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have moved to mybb to vanilla and want to redirect old threads to the new format, so the indexed threads on Google aren't lost.

The old format is


Whereas the new format is


How would I redirect this via .htaccess?

share|improve this question
Why is the new format index.php?p=/discussion/3003? Because /discussion/3003 is much nicer than index.php?p=/discussion/3003. – Adjam May 12 '12 at 10:31
I agree, thats what the new software has, would i be able to change it to /discussion/3003 ? – h00j May 12 '12 at 10:47
Yes. Ask it as a separate question though: How do I change index.php?p=/discussion/3003 to /discussion/3003 with .htaccess? – Adjam May 12 '12 at 11:28

You will want to use a 301 redirect (permanently moved) so that google will update its indexes with the new URLS, as users are redirected.

RewriteEngine on
RewriteBase /
RewriteCond %{QUERY_STRING} tid=([0-9]*)$
RewriteRule showthread.php index.php?p=/discussion/%1 [L,R=301]
share|improve this answer
Also, for your follow up, yes, you would update the rule above to just redirect to the "clean" url, and then use a silent rewruite to ivoke index.php...corz.org/serv/tricks/htaccess2.php?page=2#not-so-simple – Eddie May 12 '12 at 12:17
For some reason with this rewrite it redirects to mysite.com/home/mysite/public_html/index.php?p=/discussion/3003 – h00j May 12 '12 at 13:04
add rewritebase / – Eddie May 12 '12 at 17:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.