0

I am using ASP MVC as my lanugage and I have a website with multiple subfolders/applications in it.

www.sample.com

www.sample.com/zh

www.sample.com/en

What I need is to add a trailing slash to the end of the URL only.

www.sample.com/zh/

www.sample.com/en/

I am confused with the IIS rewrite parameters. Can somebody help me?

simplecoder
  • 203
  • 2
  • 9

1 Answers1

1

For reference, I did some modification with the rules:

<rule name="Add trailing slash" stopProcessing="true">
                    <match url="^.*" />
                    <action type="Redirect" url="{C:0}/" appendQueryString="true" redirectType="Permanent" />
                    <conditions>
                        <add input="{PATH_INFO}" pattern="\/zh$" />
                    </conditions>
                </rule>

This way, when /zh is encountered, it will redirect to /zh/ only,without breaking the existing urls.

Hope this helps somebody!

simplecoder
  • 203
  • 2
  • 9