Do you want to move a XenForo forum from a subdomain (like say forum.yourdomain.com) to the root domain (yourdomain.com)? The process is fairly simple and easy to follow.
Here is a complete step by step guide to properly move a XenForo forum from a forum.yourdomain.com to yourdomain.com
Also, check out How to Move XenForo to a New Domain or How to Move XenForo To New Host.
Step 1: Change XenForo License
Each XenForo license is associated with a domain or subdomain. The first step is to change the license url from XenForo’s customer area from the subdomain to the main domain.
One can change license url for an active as well as expired license.
Step 2: Move Files
In CPanel, one can move files using the CPanel’s file manager to drag and drop files from the subdomains public_html folder to main domain’s public_html folder.
If you are using Plesk or any other web server control panel, it will have a similar file manager to move the files.
Step 3: Redirect Sub Domain
Browse XenForo forum on the main domain. Everything should look ok. XenForo should be able to connect to the same subdomain’s MySQL database.
Once everything looks ok, redirect the subdomain to the main domain so you don’t lose the SEO benefits for the subdomain as well as any users visiting the subdomain via browser bookmarks or via social media are redirected.
Add a .htaccess file in the public_html folder of the subdomain with the following lines
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{HTTP_HOST} ^SUB\.DOMAIN\.com$ [NC] | |
RewriteRule ^(.*)$ http://DOMAIN.com [R=301,L] |
NOTE: If you are using HTTPS, you may want to redirect the final url to HTTPS-based and not an HTTP-based url. How to Switch An Existing XenForo Setup to Secured SSL (HTTPS).
Step 4: Change XenForo settings and GWT
Make changes in the following settings in XenForo admin area.
- Options – Admin CP > Options > Basic Board Information and change Board URL as well as homepage url and any other URLs (contact, terms etc) that point to the subdomain to the root domain.
- Google Analytics – If you were tracking subdomain only under Google Analytics, you may either want to change the property settings in Google Analytics or want to add new web property code for the main domain. Check if the right web property ID is set under the “Google Analytics Web Property ID” in Admin CP > Options > Statistics and Metrics.
- Extra HTML – If you have any page nodes or node description or notices contain HTML and have URLs or images referencing the subdomain, edit the HTML.
Once the setting changes are done from the subdomain to root domain, regenerate the XML sitemap under Admin CP > Tools > Rebuild Caches > Rebuild XML Sitemap.
Once sitemap rebuild is complete, update Google webmaster tool for a change of address for the subdomain to the main domain.
To change the address in Google webmaster tool, you will need to add the main domain as a separate property and then select it as a new site for the old subdomain.
Step 5: Change URLs inside the post content
The last and final step is to change the URLs inside the post content for any reference to the subdomain to the root domain. We will use Post Content Find / Replace. A guide on how you can install the plugin is here.
The plugin adds an option under Admin > Tools > Replace In Posts.
- In quickfind use: forum.domain.com
- In Regular expression use: #forum\.domain\.com#siU
- In Replacement String use: domain.com
Do a dry run and do not tick save changes unless you are fully sure of what is being replaced in the posts. Once things look as expected, tick “Save Changes” to save the changes in the database. The action can’t be undone and you may even corrupt the database.