• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 Switching from subdomain

#1
Hello,

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
#2
Add this to the top of your .htaccess file to enforce one URL:

Code:
RewriteEngine On

RewriteCond %{HTTP_HOST} !^mysite\.com$
RewriteRule ^(.*)$ http://mysite.com/forum/$1 [R=301,L]
That should do it.
 
#3
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
#4
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.