I have been using mod_rewrite url rewriting on my IIS installation and I thought it may help some people to share it:
IIS does not come with mod_rewrite like Apache, but you can get a free add on to do mostly the same URL rewrite things.
It is called
Isapi Ionic Rewrite Filter.
There are details on how to set it up on the distribution, but basically, this is how:
- Copy 2 files on your server, IsapiRewrite4.dll and IsapiRewrite4.ini
In my share sy9 installation, I only need one copy in the Sy9 main installation folder because I use the same rewrite rules for all blogs, but you could have one set in each blog folder for different rules.
- In IIS console, go the the properties sheet of each blog site and install the ISAPI filter IsapiRewrite4.dll
- Modify the IsapiRewrite4.ini with the rules, the syntax is very similar to the .htaccess file
For my rather standard set of rules, the IsapiRewrite4.ini file reads:
Code: Select all
RewriteRule ^/((archives/([0-9]+)-[0-9a-zA-Z\.\_!;,\+\-\%]+\.html)/?) /index.php?/$1 [NC,L,QSA]
RewriteRule ^/(authors/([0-9]+)-[0-9a-zA-Z\.\_!;,\+\-\%]+) /index.php?/$1 [NC,L,QSA]
RewriteRule ^/(feeds/categories/([0-9;]+)-[0-9a-zA-Z\.\_!;,\+\-\%]+\.rss) /index.php?/$1 [NC,L,QSA]
RewriteRule ^/(feeds/authors/([0-9]+)-[0-9a-zA-Z\.\_!;,\+\-\%]+\.rss) /index.php?/$1 [NC,L,QSA]
RewriteRule ^/(categories/([0-9;]+)-[0-9a-zA-Z\.\_!;,\+\-\%]+) /index.php?/$1 [NC,L,QSA]
RewriteRule ^/archives([/a-zA-Z0-9]+)\.html /index.php?url=/archives/$1.html [NC,L,QSA]
RewriteRule ^/([0-9]+)[_\-][0-9a-zA-Z_\-]*\.html /index.php?url=$1-article.html [L,NC,QSA]
RewriteRule ^/feeds/(.*) /index.php?url=/feeds/$1 [L,QSA]
RewriteRule ^/unsubscribe/(.*)/([0-9]+) /index.php?url=/unsubscribe/$1/$2 [L,QSA]
RewriteRule ^/approve/(.*)/(.*)/([0-9]+) /index.php?url=approve/$1/$2/$3 [L,QSA]
RewriteRule ^/delete/(.*)/(.*)/([0-9]+) /index.php?url=delete/$1/$2/$3 [L,QSA]
RewriteRule ^/(admin|entries)(/.+)? /index.php?url=admin/ [L,QSA]
RewriteRule ^/archive/? /index.php?url=/archive [L,QSA]
RewriteRule ^/(index|atom[0-9]*|rss|b2rss|b2rdf).(rss|rdf|rss2|xml) rss.php?file=$1&ext=$2
RewriteRule ^/(plugin|plugin)/(.*) /index.php?url=$1/$2 [L,QSA]
RewriteRule ^/search/(.*) /index.php?url=/search/$1 [L,QSA]
RewriteRule ^/comments/(.*) /index.php?url=/comments/$1 [L,QSA]
RewriteRule ^/(serendipity\.css|serendipity_admin\.css) /index.php?url=/$1 [L,QSA]
RewriteRule ^/index\.(html?|php.+) /index.php?url=index.html [L,QSA]
RewriteRule ^/htmlarea/(.*) htmlarea/$1 [L,QSA]
RewriteRule ^/(.*\.html?) /index.php?url=/$1 [L,QSA]