Jump to:

4938 Posts in 16689 Topics by 1490 members

Installing SilverStripe

SilverStripe Forums » Installing SilverStripe » Unable to load resources when using virtualhosts

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: 538 Views
  • jaminday
    Community Member
    1 Post

    Unable to load resources when using virtualhosts Link to this post

    Hi all,
    Just wondering if anyone has any advice on getting SilverStripe working with virtualhosts on a local WAMP server? I'm finding that the home page loads (on a vanilla install, v 3.0.3), but none of the resources are loading (e.g. CSS, JS). The browser appears to be looking for them at http://themes/simple/css/reset.css (for example), instead of http://silverstripe.dev/index.php/themes/simple/css/reset.css.

    To clarify, I'm only having this issue when using a virtualhost. The resources load fine when running from http://localhost/silverstripe.

    I suspect the problem is in my htaccess file, but I don't know enough about htaccess to work out how to fix it. Here's what I've got in my htaccess currently (which lives in the site's root directory):

    # Vhosts Server root folder. File .htaccess
    # This file provides server security limiting access to the localhost only.
    # Comment next four lines to deactivate. (Allows external access)

    Order Deny,Allow
    Deny from all
    Allow from
    Allow from ::1

    # To allow execution of cgi scripts in this directory uncomment next two lines.

    #AddHandler cgi-script .pl .cgi
    #Options +ExecCGI +FollowSymLinks
    Options +FollowSymLinks

    # Activate this section to use the Private Server Feature!
    # AuthName: Replace with a suitable name appropriate to your site
    # AuthType: Do not change
    # AuthUserFile: ../../../htpasswd Corresponds to folder UniServer\htpasswd
    # In folder UniServer\htpasswd create a new folder e.g Vhost_1
    # In this new folder create a new file named .htpasswd
    # Edit this file and add a name and passwrd for example
    # name123:password45
    # Path will look like this (replace xxx with your new folder):
    # ../../../htpasswd/Vhost_1/.htpasswd
    # Note: AuthUserFile - File path is relative to server root
    # To lock server, uncomment the next 4 lines. (A name and password is required)

    #AuthName "Uniform Server - Server Access"
    #AuthType Basic
    #AuthUserFile ../../../htpasswd/xxx/.htpasswd
    #Require valid-user

    <Files *.ss>
       Order deny,allow
       Deny from all
       Allow from

    <Files web.config>
       Order deny,allow
       Deny from all

    ErrorDocument 404 /assets/error-404.html
    ErrorDocument 500 /assets/error-500.html

    <IfModule mod_alias.c>
       RedirectMatch 403 /silverstripe-cache(/|$)

    <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteBase '/'

       RewriteCond %{REQUEST_URI} ^(.*)$
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteRule .* framework/main.php?url=%1&%{QUERY_STRING} [L]

    Any ideas?

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.