views:

26

answers:

2

I am using urlrewriter.net and I am trying to make a redirection. So here is the condition,

If the requested url doesn't end with a / (slash) and then add / at the end of the url and redirect to added url.

So if the url is "http://www.something.com/cases" then add / and redirect it to "http://www.something.com/cases/"

I've used code but it didn't work out for me :

<if url="^~/(.+)(/){0}$">
    <redirect url="~/(.+)" to="~/$1/$"/>
</if>
A: 

Can you use the URL Rewrite 2.0 module? You can easily add it there, because the rewrite template for that rule is a built-into the GUI.

citronas
Well, I am thinking to move forward to URL Rewrite 2.0 since Microsoft already supports in right inside of IIS.
Braveyard
A: 

I am going to answer my own question here :

I've accomplished this by using this way :

<unless url="^(/.+(\.gif|\.png|\.jpg|\.ico|\.pdf|\.css|\.js|\.aspx|\.ashx|\.ascx|\.shtml|\.html|\.htm)(\?.+)?)$">
    <if url=".+(?&lt;!/)$">
        <redirect url="(.+)" to="$1/"/>
    </if>
</unless>

If url doesn't end with "/" then it will be redirected to the one which has "/" at the end.

I hope it helps everyone out there.

Braveyard