Hi everyone, I fiddled with this for a few hours now and I can't get it to work.
I followed the instructions and also read this post.
I'm testing this on a silverstripe in a subdirectory (/mydir/) of my server and the CMS per se works perfect.
So, on http://www.mysite.com/mydir/dev/buildcache?flush=1 it also builds the cache pages just fine, but I can't get the .htaccess right...
This is what resides in /mydir/.htaccess:
### SILVERSTRIPE START ###
<Files *.ss>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Files>
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /mydir
## CONFIG FOR DEV ENVIRONMENTS
# Cached content - mydir subdirectory
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_URI} ^/mydir/(.*)$
RewriteCond %{REQUEST_URI} /mydir/(.*[^/])/?$
RewriteCond %{DOCUMENT_ROOT}/mydir/cache/%1.html -f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /mydir/cache/%1.html [L]
# Cached content - homepage
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_URI} ^/mydir/?$
RewriteCond /mydir/cache/index.html -f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /mydir/cache/index.html [L]
## CONFIG FOR TEST/LIVE ENVIRONMENTS
# Cached content - live webserver
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_URI} /(.*[^/])/?$
RewriteCond %{DOCUMENT_ROOT}/cache/%1.html -f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /cache/%1.html [L]
# Cached content - homepage
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_URI} ^/?$
RewriteCond %{DOCUMENT_ROOT}/cache/index.html -f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /cache/index.html [L]
## DYNAMIC CONFIG
# Dynamic content
RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
</IfModule>
### SILVERSTRIPE END ###
But somehow the rewriterules never kick in. It always gives back the data from the CMS.
I know a bit about apache rewriterules and tried out a lot, patched here and there to find what's keeping it from kicking in and so on. But now i think I can't look straight at it anymore and have to ask for help :)
Does anybody find the general error in this .htaccess?