You mean to just redirect one folder to another?
Pretend your old forum was at http://www.domain.com/phpbb2 and the new one is at http://www.domain.com/bbpress
Delete the phpbb2 folder and in your .htaccess add this:
RewriteRule ^phpbb2(.*)$ http://www.domain.com/bbpress/ [L,R=301]
That will make what’s called a Permanent redirect, and in theory teach site crawlers what’s up. Mind, a 401 is for unauthorized access, which is an odd error to get.
Hello Ipstenu, thanks for your response. Sorry, I should have mentioned that the new bbpress board is actually on the same folder as the previous phpbb one (/forum), however, I get people coming from google trying to find phpbb pages like:
/forum/viewtopic.php?p=66sid=c72c343df3c37339b4d5094a1296566d
,but the new pages now look more like: forum/topic.php?id=38 on bbpress.
I was wondering if there’s a code I can add so people coming from google at least can be redirected to the forum’s index, right now they’re getting a 404 (sorry, I said 401 previously) because the old page can’t be found.
At least until google indexes everything again.
Thanks.
You would need to map all the old phpBB URLs to new bbPress URLs, one to one, since it doesn’t look like there’s an easy way to create a rewrite rule. Once you have all the URLs before and after, you can create 301 redirect rules in your .htaccess file.
At a guess…
RewriteRule ^forum/faq(.*)$ http://www.domain.com/forum/ [L,R=301]
RewriteRule ^forum/mcp(.*)$ http://www.domain.com/forum/ [L,R=301]
RewriteRule ^forum/member(.*)$ http://www.domain.com/forum/ [L,R=301]
RewriteRule ^forum/search(.*)$ http://www.domain.com/forum/ [L,R=301]
RewriteRule ^forum/ucp(.*)$ http://www.domain.com/forum/ [L,R=301]
RewriteRule ^forum/view(.*)$ http://www.domain.com/forum/ [L,R=301]
That’s the majority of the links, I think. At least the ones off the main page of a forum.
Thanks Chris and Ipstenu for your reply. I will give it a try and report back!
What would the RewriteCond be in this case?
Any clue on what the RewriteCond code for this would be? I’ve been trying to look this up but haven’t found anything yet.
You shouldn’t need a RewriteCond in that case, the RewriteRule can work without it if it’s simple enough.
If you are using the .htaccess inside of the /forum/ directory though, the above examples need to be trimmed without the forum/ part.
ie.
RewriteRule ^forum/faq
should actually be
RewriteRule ^faq
Only leave the forum/
part in there if you are using the .htaccess in the parent (webroot) folder.