So basically, the order should be:
1. Change the location of the forum in bb-admin
2. Immediately rename the directory
3. Modify rewrite rules in .htaccess
Is there any more to it than that?
The annoying part is that despite the RewriteBase
directive all rewrite rules in .htaccess are in the form:
RewriteRule ^the-page/(something)/?$ /forum/index.php?the-page=$1 [L,QSA]
so you need to change all the rules. Or you can switch to numeric mode and then switch back to name-based permalink mode and maybe bbPress will auto-fix it for you.
Blanking .htaccess
and re-setting permalinks is quicker and less error-prone, imho.
Here’s what worked for me.
I changed from website.com/forum/ to forum.website.com/
I had name-based permalinks. My forum was in public_html/forum
1) Set up the subdomain (used cpanel with host; this uses the same dir as before)
2) Switch name-based permalinks to none (very important! You can do this temporarily. Nothing bad happened to me.)
3) Change the URL from website.com/forum/ to forum.website.com/ in general settings.
4) I had to log back in again after this step.
5) Go to admin. I couldn’t get to admin after logging in. The link was pointing me to forum.website.com/forum/bb-admin … I manually typed in
forum.website.com/bb-admin .. that worked.
6) Change back to name-based permalinks.
7) The admin link magically works now.
Go into .htaccess and insert things like
RedirectMatch 301 /forum/topic/(.*)$ http://forum.website.com/topic/$1
Solved!
Curses! Not completely solved.
I think my .htaccess is wrong. Currently, it only works with “none”/number based permalinks. When I switch to name-based, I get
I’m sorry, but there is nothing at this URL,
when I click on forums and topics.
Any ideas?
One dumb question: Is it possible to have two separate .htaccess files? One for the blog in public_html/htaccess and one for the forum in public_html/forum/.htaccess?
Okay, figured out that two .htaccess files are okay. This is what I have in public_html/forum/
# BEGIN bbPress
Options -MultiViews
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^page/([0-9]+)/?$ /index.php?page=$1 [L,QSA]
RewriteRule ^forum/([^/]+)/page/([0-9]+)/?$ /forum.php?id=$1&page=$2 [L,QSA]
RewriteRule ^forum/([^/]+)/?$ /forum.php?id=$1 [L,QSA]
RewriteRule ^forum/?$ / [R=302,L,QSA]
RewriteRule ^topic/([^/]+)/page/([0-9]+)/?$ /topic.php?id=$1&page=$2 [L,QSA]
etc.
These rules seem to stay the same regardless of what kind of permalinks I set. Does that make sense?
As mentioned in the post at the top: The front page works fine. All the links are broken in named-based permalinks, but work fine with “None”.