XF 1.5 Question about moving XF to root from /forum

actionmedia

Active member
Hello,

To give you some background on my forum, it's over 17 years old. I've always had a homepage (WordPress) at the root, and the forum located in /forum. Actually, I switched from Invision Board two years ago, in which the forum used to be in /forums, and now it's in /forum. I installed the Invision redirect script, and it redirects all old threads to their new threads.

Needless to say, there are millions of posts, many with internal links. Additionally, there are a lot of backlinks (people linking into certain threads).

I am about ready to get rid of WordPress, and just move the forum to the root, as I don't see much benefit to having WordPress any longer.

My concerns are as follows:
  1. I would like the root (domain.com) to be a portal, where it shows featured articles. I know there are a few good XenForo portals available, so this is easy.
  2. Today, my forum is located in /forum. I would like to keep this structure, because of the many internal and backlinks to the threads. It seems when you install a portal or move XF to the root, it changes the forum url to /forumS. Can it remain /forum (without the S)?
  3. Members have embedded a lot of pictures in their posts from the gallery. The links are something like: domain.com/forum/media/picturefilename.jpg. I'd want to ensure that these embedded URLs still work.

I read a little about routes, but still unclear what they do exactly. If anyone can provide some feedback, I would greatly appreciate it.

Thank you for your time...

Best,
Rod
 
By the way, if the new forum URL needs to become /forumS, I'm fine with that as long as there's a simple redirect to preserve the links, especially those internally with embedded pictures to the gallery.
 
I've done a lot of reading, and I think I figured out what I need to do. If I move my site to the root, can I use a rewrite rule to redirect anyone who goes to /forum to / forumS? Lastly, will embedded pictures within my forum (which point to domain/forum/media/picture.jpg) still work? Does the rewrite rule take care of these embedded URL's as well? Thank you.
 
Tis is what I did:

Move xenforo to root. Keep the old /forum/ subdirectory and in there place an .htaccess file with this:

Code:
RewriteEngine On

RewriteRule ^(.*)$ /$1 [R=301,L]

This should work with all your inbound links as well as your internal links (but there is no harm in changing al your internal inks)

The alternative way (possibly more correct) is to use the root's .htaccess, however I couldn't get that to work - not sure why.

Something like this should theoretically work:

Code:
RedirectMatch 301 ^/forum/$ http://example.com/
 
Thanks for the tip. So this will also take care of those embedded pictures as well?

I think so, however with any htaccess there is nothing quite like trying it out and seeing if it works.

In this case it takes less than a minute to try it.

  • Move you files to root
  • Add line to htaccess
  • test

If it doesn't work delete the line (or comment it out with #
Move the files back and scratch your head and wonder what went wrong
 
Top Bottom