Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Installing Vanilla into subdirectory, but serving from documentroot

edited April 2012 in Vanilla 2.0 - 2.8

Hi all.

I'm attempting to install Vanilla into a subdirectory of my websites document root, but to serve it from the docroot.

Why would I want to do this?

To try and make upgrades as easy as possible with git.

I've checked out vanilla into a subrepository so that I can pull down updates and keep everything in sync with latest release tags. Because I don't want to modify any of the original files, I've duplicated the index.php file and the conf directory and moved them into the document root.

This gives me the following file structure:

  • index.php
  • conf/...
  • vanilla/...

Then in index.php, I've added the following constant at the top:

define('PATH_CONF', __DIR__.'/conf');

I've also updated the PATH_ROOT constant:

define('PATH_ROOT', __DIR__.'/vanilla');

This then allows me to make any config changes I need in a directory outside of the subrepository.

So I'm basically wondering, are there any other config variables or constants (and possibly files) that I may need to alter? Because at the moment, when trying to use the installer, the themes, images and CSS for the page seem to be ignoring the PATH_ROOT constant, and trying to serve files from the document root rather than /vanilla.

Is this even possible? - I guess this is also an important question to be asking!

My aim is to have my configuration and themes outside of the main vanilla repository, which I want to leave as, vanilla (pun intended) as possible.


  • I've also now added to the conf/config.php file:

    $Configuration['Garden']['WebRoot'] = '/vanilla';

    However, this is being ignored for the install page.

    Doing some testing, and I'm not sure if these are the correct functions to be doing so, but:

    echo Gdn_Url::WebRoot(); is an empty string. However, echo Gdn::Config('Garden.WebRoot'); returns the correct value of /vanilla.

  • So it looks as though WebRoot has been removed and is not being used anymore. Does this mean there isn't a way to do this?

Sign In or Register to comment.