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?

  • 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
  • 1
    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]
| 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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