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?

2
  • are you using Url helper to generate urls? Commented Aug 11, 2016 at 7:24
  • Hi. Yes, and no. I use sometimes just basic relative urls in the code. Commented Aug 12, 2016 at 8:22

1 Answer 1

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!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.