Require a trailing slash

Topics: Developer Forum, User Forum
Feb 9, 2007 at 10:01 PM
Isapi_Rewrite has a nice sample on how to require all urls without file ext's to end in a trailing slash.

#Fix missing slash char on folders
RewriteCond Host: (.*)
RewriteRule (^.?+^.?/) http\://$1$2/ I,RP

I am still feeling my way around IIRF. Any samples/suggestions on how to duplicate this behavior?

Feb 24, 2007 at 2:44 AM
RewriteRule ^/([^.?]+[^.?/])$ /$1/ [I,R=301]

The above rule will have the following results:

request Rewrite Result
'/foo/something' Redirect (301) to '/foo/something/'
'/home/foo/admin' Redirect (301) to '/home/foo/admin/'
'/module.php' No rewrite
'/foo/something.aspx' No rewrite
'/foo/something.' No rewrite
Jun 12, 2007 at 8:04 PM
Awesome! Been looking for something like this! Works great. Thanks Cheeso!