Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive

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

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

Including non-Silverstripe content.


Reply

4 Posts   1403 Views

Avatar
Bruce

10 May 2008 at 4:24pm (Last edited: 10 May 2008 4:25pm), Community Member, 29 Posts

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

Avatar
Sam

10 May 2008 at 5:08pm Administrator, 679 Posts

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 ###

Avatar
christian

10 May 2008 at 5:34pm Community Member, 6 Posts

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

Avatar
Bruce

11 May 2008 at 4:47pm (Last edited: 11 May 2008 4:48pm), Community Member, 29 Posts

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