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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Hosting Requirements /

What you need to consider when choosing a hosting provider and plan.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

IIRF (url rewriting for IIS) and caching


Go to End


2503 Views

Avatar
3xcellent

Community Member, 1 Post

22 April 2011 at 6:56am

I am running SS2.4 on Windows Server 2003 (IIS6). I have IIRF installed, and SS works out of the box.

Now I'm trying to enable caching, however I cannot get my rewrite rules to work in IIRF.

I'll admit that I'm a complete newb to IIRF, and Apache .htaccess for that matter. I didn't get anywhere reading the IIRF DOCs, nor through trial and error, so now to the SS forums...

Can anyone assist?

The Rules and Conditions I'm working from work fine on a shared Linux hosting account (though I've replaced %1 with $1 for IIRF).


## these rules don't work!!!
# Cached content - IIRF
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 - IIRF
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]

## The following works, I did not edit
# URLs with query strings 
# Don't catch successful file references 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.*)\?(.+)$ /sapphire/main.php?url=$1&$2

# URLs without query strings 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.*)$ /sapphire/main.php?url=$1

I'm testing by placing a cachetest.html file in the cache folder, and then loading http://www.myexample.com/cachetest/.

http://www.myexample.com/cachetest/ gives me the SS default Page not Found, while http://www.myexample.com/cache/cachetest.html loads the html file just fine. Again, this all works as expected on a shared Linux Host, so now I'm trying to get my Windows box working.

Thanks in advance,
3xcellent