I would like to use IIS Url Rewrite but the sites I came across did not explain in-depth what do I have to do and why, there was just code to "copy-pase" and I would rather know how am I making tings work.

I have this code in my hosting site:

                <rule name="Canonical Host Name" stopProcessing="true">
                  <match url="(.*)" />
                    <add input="{HTTP_HOST}" pattern="^example\.com$" />
                  <action type="Redirect" url="http://example.com/{R:1}" redirectType="Permanent" />

I have two pages. Default.cshtml and room.cshtml which must take parameter to display properly (room.cshtml?roomId=[id here]). What I would like to achieve is:
1) Get rid of .cshtml on both these pages.
2) Make second page look like example.com/room/[id here]
3) When someone goes to example.com/room without id parameter, I would like him to get redirected to example.com/room/1

Related posts

Recent Viewed