Jump to:

546 Posts in 2232 Topics by 237 members

Hosting Requirements

SilverStripe Forums » Hosting Requirements » IIRF (url rewriting for IIS) and caching

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

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

Page: 1
Go to End
Author Topic: 1411 Views
  • 3xcellent
    Community Member
    1 Post

    IIRF (url rewriting for IIS) and caching Link to this post

    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,

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.