XF 1.5 Switching from subdomain


I created a subdomain on my site and installed Xenforo. It is like forum.mysite.com, but for some reason the forum also appears when I go to mysite.com/forum. Now what is the best way to remove the subdomain forum and only have mysite.com/forum and forum.mysite.com redirects to mysite.com/forum?

Jake Bunce

XenForo moderator
Staff member
Add this to the top of your .htaccess file to enforce one URL:

Rich (BB code):
RewriteEngine On

RewriteCond %{HTTP_HOST} !^mysite\.com$
RewriteRule ^(.*)$ http://mysite.com/forum/$1 [R=301,L]
That should do it.
This redirect works only if the subdomain stays alive, right? If I delete the subdomain, will mysite.com/forum also get deleted. How can I have mysite.com/forum and forum.mysite.com redirect to that link, but the subdomain is completely removed from the server?

Jake Bunce

XenForo moderator
Staff member
The subdomain will need to remain on the server so that both URLs are active. Then the rewrite rule will enforce redirects to just the one URL.