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

XF 1.5 Question about moving forum from /forum to /root

Discussion in 'XenForo Questions and Support' started by actionmedia, Nov 21, 2015.

  1. actionmedia

    actionmedia Member

    I recently converted from IPB to XF.

    My old forum URL (with IPB) was domain/forumS

    My new forum URL (with XF) is domain/forum (singular)

    I now want to move the forum to my root, so that the forum appears in the root domain domain.com/

    I am currently using Jakes URL redirect tool for my old threads to redirect from forums/ to forum/.

    If I move /forum to /root, what is the best way to redirect /forum to /root?

    I hope this isn't too confusing...
  2. actionmedia

    actionmedia Member

    Actually, my goal is to install a portal at my domains root. Maybe I should ask, what's the best approach?
  3. Brogan

    Brogan XenForo Moderator Staff Member

    If you intend to use an XF add-on for the portal and you want the portal at the root, XF will have to be installed in the root.

    What redirect rules are you currently using?
    It's probably just going to be a case of tweaking them slightly to remove the /forums.

    See point 5 of the FAQ here which has an example rule for moving from the /community directory to the root: https://xenforo.com/community/threads/frequently-asked-questions.5183/#post-180455
  4. actionmedia

    actionmedia Member

    Is it better to move the forum to the root, and then create a route to /forum? Wouldn't that mean I don't have to modify any redirection rules then?
  5. vbresults

    vbresults Well-Known Member

    If you want to just put the portal at root then moving and rewriting everything again is overkill. Put this in index.php in the root directory, leave the forum alone.
    $startTime microtime(true);
    $fileDir dirname(__FILE__) . "/forum";

    $fileDir '/library/XenForo/Autoloader.php');
    XenForo_Autoloader::getInstance()->setupAutoloader($fileDir '/library');

    XenForo_Application::initialize($fileDir '/library'$fileDir);

    $fc = new XenForo_FrontController(new XenForo_Dependencies_Public());
    Then, open the PAGE_CONTAINER template, and find:
    <xen:if is="{$requestPaths.fullBasePath}">
    Replace with
    <xen:if is="{$requestPaths.basePath} == '/'">
        <base href="{xen:raw $requestPaths.protocol}://{xen:raw $requestPaths.host}/forum/" />
        <script><xen:comment>/* Chrome bug and for Google cache */</xen:comment>
            var _b = document.getElementsByTagName('base')[0], _bH = "{xen:jsescape $requestPaths.protocol}://{xen:jsescape $requestPaths.host}/forum/";
            if (_b && _b.href != _bH) _b.href = _bH;
    <xen:elseif is="{$requestPaths.fullBasePath}" />
    May or may not need a route to your portal for /.

    p.s. update thread title to "install a portal at my domains root"
    Last edited: Nov 22, 2015

Share This Page