Forum Moderators: phranque
I'm trying to redirect all the obsolete URLs from my old forum to the the new forum main page (it's impossible for me to redirect all threads to the new equivalent, instead I have to do individual threads manually).
So far it's working well for everything except URLs that included dynamic content.
This is an excerpt of my apache config file:
RewriteRule ^ubbthreads/showthreaded.php/Cat/0/Number/51 http://www.example.dk/music-forums/23-bach-toccata-fugue-d.html [R=301,L]
RewriteRule ^ubbthreads/showflat(.+)$ http://www.example.dk/music-forums/ [R=301,L]
RewriteRule ^ubbthreads/showthreaded(.+)$ http://www.example.dk/music-forums/ [R=301,L]
RewriteRule ^ubbthreads/grabnext(.+)$ http://www.example.dk/music-forums/ [R=301,L]
RewriteRule ^ubbthreads/printthread(.+)$ http://www.example.dk/music-forums/ [R=301,L]
RewriteRule ^ubbthreads/showprofile(.+)$ http://www.example.dk/music-forums/ [R=301,L]
RewriteRule ^ubbthreads/ubbthreads.php http://www.example.dk/music-forums/ [R=301,L]
www.example.dk/ubbthreads/showflat.php/Cat/0/Number/520/an/0/page/0 But URLs with? dynamic content like this:
www.example.dk/ubbthreads/showflat.php?Cat=0&Number=10454&page=0&fpart=1&vc=1 www.example.dk/music-forums/?Cat=0&Number=10454&page=0&fpart=1&vc=1 which actually works. However, I'm afraid since it's a matter of thousands of pages redirecting that way, the search engines might see it as a massive case of duplicate content. (thousands of URLs with different dynamic URLs but exactly the same content (the new forum main page)).
I'd appreciate very much any help on how to make the dynamic content redirect to the genuine main page of new forum as well, thanks in advance.
[edited by: jdMorgan at 2:13 pm (utc) on Mar. 16, 2007]
[edit reason] Example.com, please see TOS. [/edit]
1) RewriteRule cannot "see" the query string, it sees only the local URL-path, and not any query data which may be appended to the URL. If you you wish to test or back-reference part of a query string, you must use a separate RewriteCond and examine the server variable %{QUERY_STRING}. However, since you intend to discard the query data, this does not directly apply in this case, except as it may influence what you should seek to match with your RewriteRule patterns.
2) To clear the current query string, append a question mark to your substitution URL.
So taking your last rule as an example, you simply need to add the question mark:
RewriteRule ^ubbthreads/ubbthreads\.php$ http://www.example.dk/music-forum[b]s/?[/b] [R=301,L]
For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].
Jim
Btw, Sorry for not reading the charter thoroughly before posting. I put the links inside code in order to avoid them being live (which strangely did not seem to work since they were still parsed), but I see I should have disguised the domain as well.