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

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...


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
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?


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";

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

XenForo_Application::initialize($fileDir . '/library', $fileDir);
XenForo_Application::set('page_start_time', $startTime);

$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: