XF 2.1 To install in root directory, or not, that is the question...

jca

Member
I'm converting a vBulletin 4 site (using the /forums directory), with the vBAdvanced add-on as the front page (root directory) of the site. I need to recreate this arrangement in Xenforo.

I've seen various threads, FAQs, etc. about whether Xenforo should be installed in the root directory, in a sub-folder, etc. I can't really make heads or tails on which way to go. (I've tried both in the root directory, and also in the /forums directory.)

The bottom line is the (Xenforo) forum needs to live at the sitename.com/forums url to maintain redirects, SEO, etc., and some sort of add-on/set-up in Xenforo needs to run the front page "portal" that would live in the root directory at sitename.com.

I've read about various methods, including the Page as portal homepage guide, the Demo Portal add-on, etc. None of these options seem to work quite right. (Example: the /forums/forums linking issue, the alpha and unsupported "Demo Portal" add-on, etc.)

What is the best way to have Xenforo forums live at /forums, and a simple portal front page (powered by Xenforo with recent threads, other widgets, etc.) as the home front page?

Appreciate any help/info with this.

Thanks!
 
If you plan on using a XF page as your front page you need xf installed in the root and use the Index page route in ACP/options/Basic board information to route the page you created as the default index page.
 
Install in the root , you can still do htaccess redirects for google and seo ( bit is a bit more complex I think if you previous installation was in /forums/ )
 
  • Like
Reactions: jca
If you plan on using a XF page as your front page you need xf installed in the root and use the Index page route in ACP/options/Basic board information to route the page you created as the default index page.
Install in the root , you can still do htaccess redirects for google and seo ( bit is a bit more complex I think if you previous installation was in /forums/ )
Thanks for the suggestions.

When I move the Xenforo install from /forums to the root / directory, changed the Board URL setting to sitename.com/forums and Index page route setting to pages/home/ (which points to a Home page I created in Nodes), the urls are still not quite right.

I see the top Forums tab menu item points to the /forums url, and the top Home tab menu item points to the sitename.com url (no directory), which is good. But some of the linked content isn't falling under the /forums sub-directory as desired. Individual forums are linked as expected via /forums/forum-name.id, but other content, such as threads/posts are linked outside the /forums sub-directory, such as sitename.com/threads/thread-title.threadid/post-postid style links. I also know that I would need to edit the vBulletin redirects as described in the XenForo redirects for vBulletin portion of the manual.

I understand that "Xenforo does things differently" as others have mentioned (especially coming from vBulletin), but I am trying cushion the dreaded Google SEO drop-off (even with redirects) that will happen with board url/changes by keeping as much of the existing /forums link structure as possible.
 
This is because (I think) your internal links contain what used to be the actual /forums/ directory and as you know xenforo uses that in the URL -not that it's a real directory but just part of the URL.

This problem seems to be unique to forums previously in a /forums/ directory. For instance I imported a vbulletin forum that was originally in the directory /forum/ and of course it did not have that issue. For the exact same reason I wanted a home page portal I moved to the root, and the redirects all work fine because there is no plural on the /forum/ to interfere with xenforos /forums/

You must have a redirect to not lose traffic or indexing in Google from external links so I think you either need to create a support ticket or wait for someone more expert than I am in configuring that redirect.

NB: you can replace the /forums/ using route filters - this might just work with redirects but I'm sorry is above my skill grade - best thing would be to try it and see what happens (No, best thing, again, would be get someone more expert than me!)
 
  • Like
Reactions: jca
I just realised I have a forum with the exact same situation, it used to be vbulletin in /forums/


Only difference I'm using the forum as the home page now

We are using this in .htaccess

Code:
RewriteEngine On

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

and it works (in conjunction with the vbulletin redirect addon) for the redirect out of /forums/ as it retains /forums/where necessary and redirects where necessary.

(This only redirects threads and forums, but you could adapt it to include users, articles or other stuff. I just kept it simple as it's really only threads or forums that were crucial to Google)

As you can see this vbulletin3 URL redirects perfecly http://www.logic-users-group.com/forums/showthread.php?t=5111 - moves out of old /forums/ and delivers the new xenforo URL. Job done!
 
Last edited:
  • Like
Reactions: jca
@Mr Lucky, thanks for all the replies about this.

I have been working with this (trying a root / install and a /forums install), and I have not been able to get it working right.

Obviously I'm running into a unique issue with /forums being used on (the old) vBulletin site url -- this is really strange to me since I'm guessing /forums is a popular (if not the MOST popular) url structure for a forum, regardless of software. I'm having trouble changing the url structure to a singular /forum url when I see the word "Forums" used in all the Xenforo menu items, breadcrumb names, etc. I understand that is just my particular hang-up -- so I did try to change /forums to /forum via a Route Filter as suggested by support, but it just breaks links and isn't working for me.

I've tried .htaccess Rewrite rules (as you mentioned), but they do not seem to have any effect. I'm not clear whether these rules should be in the root / .htaccess and/or the /forums/.htaccess (along with the index.php described in the Xenforo manual) -- but I tried it in both and it's just not working.

Any suggestions?
 
I've tried .htaccess Rewrite rules (as you mentioned), but they do not seem to have any effect. I'm not clear whether these rules should be in the root / .htaccess and/or the /forums/.htaccess (along with the index.php described in the Xenforo manual) -- but I tried it in both and it's just not working.

Any suggestions?

My example is based on the forum (that used to be in/forums/ ) is now in the root.

So no route filters involved. In fact I advise agasint that because in this case it's sooooo much better to put the forum in the root and make it simple. I mentioned the rout filter just in case you really wanted the forum to be in a subdirectory off the root for some reason.

My forum that used to be in /forums/ is now in root, .htaccess is is root - see my vbulletin3 URL in post above - it works in combination with the xenforo vbulletin redirect.
 
  • Like
Reactions: jca
My example is based on the forum (that used to be in/forums/ ) is now in the root.

Yeah, I am trying to recreate the set-up you mentioned. I've installed Xenforo in root /, and I've put in the .htaccess redirects you listed in root, so that old vBulletin links, like http://sitename.com/forums/showthread.php?t=109236 should redirect to the new Xenforo http://sitename.com/threads/thread-name.109236/ url. This doesn't work -- the old showthread link gives an error:

Oops! We ran into some problems.
The requested forum could not be found.

If I create the /forums sub-directory and put in the index.php and .htaccess as outlined in the Xenforo Manual on vBulletin Redirects, the Xenforo forum breaks, because it sees the /forums directory and tries to use that index.php in that directory with it's own /forums linking structure, making for a broken page. If I remove the /forums directory, this problem is removed.

Clearly I'm not getting how this should work -- and based on all the past threads/posts I've read about this, I'm stuck in this unique vBulletin /forums directory structure breaking Xenforo's /forums url structure.

I appreciate all the help/replies about this. If I'm missing something or should try something else, please let me know.

Thanks.
 
Yeah, I am trying to recreate the set-up you mentioned. I've installed Xenforo in root /, and I've put in the .htaccess redirects you listed in root, so that old vBulletin links, like http://sitename.com/forums/showthread.php?t=109236 should redirect to the new Xenforo http://sitename.com/threads/thread-name.109236/ url. This doesn't work -- the old showthread link gives an error:

Does the old showthread link change at all? If not it sounds like the addon is not installed correctly.


If I create the /forums sub-directory and put in the index.php and .htaccess as outlined in the Xenforo Manual on vBulletin Redirects, the Xenforo forum breaks, because it sees the /forums directory and tries to use that index.php in that directory with it's own /forums linking structure, making for a broken page. If I remove the /forums directory, this problem is removed.
Yes, I'm fairly certain that's expected - and it would be good if that was addressed in the manual. BUT this is why I gave you the alternative way to do it so that redirects are triggered at the root htaccess and no need to even create that directory. I believe it will never work to create a /forums/ subdirectory. I may be wrong but I believe the xenforo docs are based on that directory NOT being called /forums/ .

There are two very separate things to check, I would check each one separately

With the addon disabled, does the htaccess redirect out of /forums work? (Without the addon you will get an error because it is still vbulletin, but I believe you should see in the top browser field that the redirection to root did happen.

Is the addon working? Same applies. Without the htaccess redirect try the addon enabled. You should get a transfrom to xenforo format URL, but still an error because there is not yet a redirect from /forums/.

If both of those are as expected (albeit with the error) then fine. Do them together and it should work

If not you will have pinpointed whether the issue is with the addon or with the redirect.

But I do know my method works, as you can see from the example link in my post above.

NB: I found the original thread where I first asked about this, as you can see xenforo developer Mike is there helpfully answering my questions.

 
Last edited:
  • Like
Reactions: jca
With the addon disabled, does the htaccess redirect out of /forums work? (Without the addon you will get an error because it is still vbulletin, but I believe you should see in the top browser field that the redirection to root did happen.

Again, thanks for the help.

I checked both the Add-On and .htaccess (separately, as you suggested). So I believe it comes down to the .htaccess rewrites not working. For some reason, your .htaccess rules do not work on my install. I've been experimenting and getting sucked into the blackhole of mod_rewrite rule writing. I think I have it working by adding these Rewrite rules (before the other RewriteRules) in the root .htaccess:

Code:
RewriteRule ^forums/index.php /forums [R=301,NC,L]
RewriteRule ^forums/(.*)\.php /$1\.php [R=301,QSA,NC,L]

All of my vBulletin 4 urls are using the standard .php (non-seo/non-friendly/default) links. For some reason your rules weren't capturing all those .php urls like the http://sitename.com/forums/showthread.php?t=109236. So I experimented with many different rules, trying to rewrite all the various .php files (showthread.php, forumdisplay.php, members.php, etc.), and this is what I came up with.

I don't really like these rules because the second one is "greedy", and matches all .php files -- I had to add the first rule to prevent /forums/index.php from redirecting to /. I would rather this RewriteRule be a single rule using a "(showthread|forumdisplay|members).php" sub pattern to match those specific .php files instead, but I could never get it to work.

What do you think?
 
I would rather this RewriteRule be a single rule using a "(showthread|forumdisplay|members).php" sub pattern to match those specific .php files instead, but I could never get it to work.

Maybe I spoke too soon. I think this single RewriteRule might work in place of the two rules above:

Code:
RewriteRule ^forums/(showthread|forumdisplay|members|tags)\.php /$1\.php [R=301,QSA,NC,L]

Am I missing any other important .php files other than showthread.php, forumdisplay.php, members.php, and tags.php?
 
the 301 vbtoxf tool has a setup that allows /subdir to root 301s without much effort.

i vote for root install with a custom node as the index page if you so desire to have it.
 
Maybe I spoke too soon. I think this single RewriteRule might work in place of the two rules above:

Code:
RewriteRule ^forums/(showthread|forumdisplay|members|tags)\.php /$1\.php [R=301,QSA,NC,L]

Am I missing any other important .php files other than showthread.php, forumdisplay.php, members.php, and tags.php?
I can't really answer that as I'm not an expert, all I can tell you is what actually worked for me in the same exact situation. Those three rules seemed to work for the existing backlinks I could identify. Any other links that may be out there are less important for SEO, and of course any that are exsiting purely in Googles index will get corrected as Google crawls the new URLs.
 
  • Like
Reactions: jca
Top Bottom