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
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
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 ###
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
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