XF 2.2 Changing domain name


Active member
Hi, we are changing our forum's domain name. We simply transfer our site's /forum folder to another domain's root folder. For this, I'm planning to use a .htaccess redirect but I'm not sure, so decided to ask you. Is this line from this topic OK for me?

Redirect permanent /forums http://domain.com/community

For example, I want to redirect all the links of https://xyz.com/forum to https://abc.com

Is this code works for us or shoul I do something different?

Thank you very much.
Not tested but I think something like this should work:

Rich (BB code):
<IfModule mod_rewrite.c>
    RewriteEngine On

    #    If you are having problems with the rewrite rules, remove the "#" from the
    #    line that begins "RewriteBase" below. You will also have to change the path
    #    of the rewrite to reflect the path to your XenForo installation.
    # RewriteBase /
RewriteCond %{HTTP_HOST} ^olddomain\.com\forum\/$ [OR]
RewriteCond %{HTTP_HOST} ^www\.olddomain\.com\forum\/$
RewriteRule ^(.*)$ "https\:\/\/newdomain\.com\community\/$1" [R=301,L]

You may need to play with this a bit or perhaps someone else can jump in with improvements or corrections.

Also, don't forget to change the URL in the Xenforo ACP.
  • Like
Reactions: Gri
I found a shorter version for root folder's .htaccess. Maybe some people would use it later, so here it is:

RewriteRule ^forum(.*)$ https://newdomain.com/$1 [L,R=301]

This redirects old domain's forum folder to new domain's root folder.
Top Bottom