Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Including non-Silverstripe content.

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1382 Views
  • Bruce
    Avatar
    Community Member
    29 Posts

    Including non-Silverstripe content. Link to this post

    Hi I've got a bunch of non-silverstripe content which I want to add to a site.
    I don't see how to convert it easily, so I would like to just use it "as it is" with php & css in a sub-directory, well in the meantime anyway.
    The problem is, I'm not sure how to do it as the silverstripe stuff doesn't allow direct access to a file in a sub-directory.
    So when I add the directory name to the URL, the silverstripe is looking for a CMS-generated page with that name
    I'm sure there is a way ... but it's got me beat.
    //Bruce

  • Sam
    Avatar
    Administrator
    679 Posts

    Re: Including non-Silverstripe content. Link to this post

    The .htaccess file is designed to serve up a static file if a file is requested. If a file with the given URL exists, such as mysite/css/layout.css, this will work fine. However, if you try and access a directory, it doesn't work like this.

    A potential solution is to update the .htaccess file. I haven't tested this, so good luck, and let us all know how it goes.

    There's a block like this:

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

    Try changing it to this:

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

  • christian
    Avatar
    Community Member
    6 Posts

    Re: Including non-Silverstripe content. Link to this post

    With that condition

    RewriteCond %{REQUEST_FILENAME} !-d

    you gave access to all subfolders.

    If you only want one folder accessable you could try this condition in your .htaccess

    RewriteCond %{REQUEST_URI} !/foldername

  • Bruce
    Avatar
    Community Member
    29 Posts

    Re: Including non-Silverstripe content. Link to this post

    A bit of quiet checking goes a long way...
    The directory name I was using was the same as the URI of a re-director page, that I had created earlier, so it all started to work once I re-named the re-director.
    The solution below (specifically opening the directory) would have worked, but I don't want to allow directory listings to be available either.
    The specific file names in a directory which doesn't conflict with others are now offering up nicely.

    Thanks for the suggestions though

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