Move GUI location to a sub-directoryi

FreePBX 15 distro, location of the web GUI is /var/www/html/. I’d like to move it to a sub-directory, say /var/www/html/pbx/. When I do that, it doesn’t work. Redirects correctly to …/admin but that’s it. Couldn’t find any configuration options, neither any answer on google. Has anyone successfully tried it?

When you install FreePBX (off the reservation) you can add

./install --webroot=/var/www/html/pbx 

to suit your whim

The Clue being ./install --help

but more elegantly. FreePBX by default puts the admin by default in /var/www/html/admin and ucp in /var/www/html/ucp, so you can arrange your preferred services around or replacing the extant /var/www/html/admin/index.php or better still defining your virtual httpd servers to suit.

Thanks for the reply. Reinstall is not an option right now. I figured out there’s a number of softlinks to update in /var/www/html but gave up and will use apache virtual server feature.

Is there any specific reason you wish to do this?

Most things are relative to the setting AMPWEBROOT so if that is set correctly everything should just work no matter where it is.

You don’t need to reinstall

 cat /var/www/html/index.php 
//      License for all code of this FreePBX module can be found in the license file inside the module directory
//      Copyright 2013 Schmooze Com Inc.
if (file_exists(dirname(__FILE__) . '/index_custom.php')) {
        include_once(dirname(__FILE__) . '/index_custom.php');
} else {
        $basename = pathinfo($_SERVER['PHP_SELF'],PATHINFO_DIRNAME);
        $uri = (!empty($basename) && $basename != '/') ? $basename . '/admin' : '/admin';
        header('Location: '.$uri);

So if /var/www/html/index_custom.php exists it would be used.All you need is a working index_custom.php that fits your needs, you could still get to admin (or whatever) at

I would think so too, noticed that script. However there is a number of files being softlinks. Basically everything in /var/www/html/admin/assets/* points to /var/www/html/admin/modules/*/assets and when moved, all those softlinks are invalid.
Anyway, I just created virtual servers in Apache and all works as expected. Thanks!

1 Like

The reason was, I didn’t want the FreePBX to be exposed as the / (root) folder. I’m running some other service too. And no, it does NOT work, as I mentioned there are softlinks being absolute directory address, all broken when moved. This is something difficult to resolve in Linux, need some hand-crafted scripts that I have no skills to make.

Those links are generated on reload based on what is in the variable I mentioned above

So I moved it, did asterisk core reload now (also tried restart) and the soft-links did not update. Variable in the index.php is dynamically generated upon website load and has nothing to do with the links… So either I don’t quite get it or it’s just not gonna work.
Indeed creating index_custom.php is a good workaround, freePBX available on /admin which is good enough for me.

Those links are generated by FreePBX fwconsole reload if they don’t update in your browser after that completes check your browser cache

and ucp will be in $basename/ucp or just a plain $basename which satisfies most clients. (provisioning might be more tricky :wink: ).
For me who does not use the ‘distro’ it is an easy way to mask your admin site trivially

cat /var/www/html/index_custom.php 
        $basename = pathinfo($_SERVER['PHP_SELF'],PATHINFO_DIRNAME);
        $uri = (!empty($basename) && $basename != '/') ? $basename . '/ucp' : '/ucp';
        header('Location: '.$uri);

but please be inventive.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.