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.

Archive /

Our old forums are still available as a read-only archive.

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

URL rewriting for older versions of IIS (5.0, 5.1, 6.0)


Reply


6084 Views

Avatar
cheekygeek

Community Member, 6 Posts

12 December 2008 at 10:25am

Edited: 12/12/2008 11:11am

Haven't seen this mentioned anywhere, so I thought I'd let the developers know about it:
IIRF ([url]http://www.codeplex.com/IIRF[/url] )
This would seem to have some advantages over the URL rewriters listed on [url]http://doc.silverstripe.com/doku.php?id=iis-installation[/url]

The only thing is, it doesn't read .htaccess files or web.config XML files. It uses its own .ini file. Here is an example of one made for use with Drupal:

# DrupalRules.ini
#
# from redamo
#
# remember to rename this file to IsapiRewrite4.ini ,
# or copy this content to a file named IsapiRewrite4.ini
# before using it!
#
# Fri, 11 May 2007 12:42
#

RewriteLog E:\temp\iirfLog.out
RewriteLogLevel 3
RewriteFilterPriority HIGH

# Accept a url with the following directories and pass them through unchanged.
RewriteRule ^/misc/(.*)$ /misc/$1
RewriteRule ^/files/(.*)$ /files/$1
RewriteRule ^/modules/(.*)$ /modules/$1
RewriteRule ^/themes/(.*)$ /themes/$1
RewriteRule ^/sites/(.*)$ /sites/$1
RewriteRule ^/uploads/(.*)$ /uploads/$1
RewriteRule ^/css/(.*)$ /css/$1
RewriteRule ^/images/(.*)$ /images/$1

# for modules that provide their own js (tinymce,img assist etc)
RewriteRule ^(.*\.js)$ $1
RewriteRule ^(.*\.gif)$ $1
RewriteRule ^(.*\.png)$ $1
RewriteRule ^/modules/tinymce/(.*)$ /modules/tinymce/$1

# Make URLs sane
RewriteRule ^/cron\.php$ /cron.php
RewriteRule ^/index\.php\?q\=(.*)$ /index.php?q=$1
RewriteRule ^/update\.php\?op\=(.*)$ /update.php?op=$1
RewriteRule ^/update\.php /update.php
RewriteRule ^/xmlrpc\.php /xmlrpc.php

RewriteRule ^/robots\.txt /robots.txt

# Handle query strings on the end
RewriteRule /(.*)\?(.*)$ /index.php\?q=$1&$2

# now pass through to the generic handler
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/(.*)$ /index.php?q=$1

If somebody could come up with what rules would be appropriate for a SilverStripe installation, we'd have an easy way for LOTS of IIS 5, IIS 5.1, and IIS 6 users to start using SilverStripe! (Like me. I'm struggling to get it running on a 2000 Server/IIS 5.0) I've got it installed, but the Clean URL feature is driving me nuts!

We could also provide the SilverStripeRules.ini file back to the IIRF author for him to include in future downloads, thus driving more potential people to SilverStripe.

Basically, we just need somebody with RegEx chops to translate this:

### SILVERSTRIPE START ###
RewriteEngine On
RewriteBase /intranet

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]
### SILVERSTRIPE END ###

into the form that the DrupalRules.ini uses (above)

What say you?