Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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

showthread.php?tid=3003

Whereas the new format is

index.php?p=/discussion/3003

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
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

1 Answer 1

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

 
discard

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.