Jump to:

4945 Posts in 17750 Topics by 1494 members

Installing SilverStripe

SilverStripe Forums » Installing SilverStripe » System Files Outside Web Root

Getting SilverStripe up and running on your computer and on your web server.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1489 Views
  • msgro_uk
    Community Member
    1 Post

    System Files Outside Web Root Link to this post

    Hi all,

    I discovered SilverStripe a couple of days ago, and it looks superb. A nice, intuitive but powerful CMS, with an MVC framework for extending the core functionality. Great stuff!

    Anyway, I digress. The reason I'm posting is because I'd like to know if there's a way of installing the SilverStripe system files outside of my document root, ensuring that only the bare minimum of files are available via direct HTTP requests. (I've read in relation to other MVC frameworks that this approach is considered to be a security best practice.)

    So far I've tried installing the entire system within my document root using the install script, then moving all the files except .htaccess into a folder parallel to my document root (say "SilverStripeSystem"), then editing the following line in .htaccess:

    RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]

    to read:

    RewriteRule .* ../SilverStripeSystem/sapphire/main.php?url=%1&%{QUERY_STRING} [L]

    This seems to pick up the template correctly, but returns a "page not found" message instead of the page content.

    To rectify this, I tried editing SilverStripeSystem/sapphire/core/Core.php, changing the line:

    define('BASE_URL', dirname(dirname($_SERVER['SCRIPT_NAME'])));


    define('BASE_URL', '/SilverStripeSystem');

    This caused the page content to be returned correctly, but the internal URLs were pointing to my SilverStripeSystem folder instead of my document root when rendered into HTML. At that point, I thought I'd seek help!

    None of this is particularly urgent, of course, and I can just put the entire SilverStripe folder inside my document root if need be. However, if it's possible to achieve the configuration I'm outlining, I'd be particularly pleased.

    Would it be worth adding a feature in the install script in a future version to allow the system files to be stored in a location of the user's choice?



  • alexyoungs
    Community Member
    5 Posts

    Re: System Files Outside Web Root Link to this post

    Hi Martin,

    Did you get any further with this or get any advice from anywhere else? It's something that I'm interested in figuring out as well and if I can avoid spending a day or more hunting through the core to figure out what needs editing that would be preferable!



  • Martin D.
    Community Member
    21 Posts

    Re: System Files Outside Web Root Link to this post

    Any update on the subject?

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.