What is a URL Rewrite Rule
URL rewrite rules are rules that allow a visitor to use a shortened or simplified URL to access a page on a website.
For example, a visitor browses to the page http://mywebsite.com/service1 and is shown the page at http://mywebsite.com/uk/services/service1
This is typically used to make URLs shorter or more friendly.
It is different from a redirect which forwards the visitor from the original URL to the redirected one and updates the URL in the browser bar. A rewrite keeps the original URL in the address bar.
How to add URL Rewrite Rules
You will need to contact Vuture Support to add URL rewrite rules to your website.
Please provide a spreadsheet with the first column containing the required new URL and the second column containing the full URL of the existing page that should be displayed. Ensure that the all URLs are part of the same website
Your Vuture team will add a section similar to that below to the web.config for the site.
Instructions to Vuture Administrators
How to add manually
For each rewrite rule add an entry where key = new URL and value = URL of the page to be displayed.
The rewrite map and rule need to be inserted in the web.config inside the <web.server> section. Note that there should not be more than one <rewrite> section.
<rewrite>
<rewriteMaps>
<rewriteMap name="RewriteMap">
<add key="/service1" value="/uk/services/service1" />
<add key="/service2" value="/uk/services/service2" />
<add key="/service3" value="/uk/services/service3" />
</rewriteMap>
</rewriteMaps>
<rules>
<rule name="Rewrite Rule for RewriteMap" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{RewriteMap:{REQUEST_URI}}" pattern="(.+)" />
</conditions>
<action type="Rewrite" url="{C:1}" appendQueryString="True"/>
</rule>
</rules>
</rewrite>
How to add through the IIS GUI
- Identify the relevant site within sites in IIS
- Right-click and choose explore and make a backup-copy of web-config
- Double-Click "URL Rewrite"
- Click Add Rules(s)
- Choose "Rule with rewrite map"
- In "Select the rewrite map" type a name for your map eg "ShortURL"
- in rewrite map, add a mapping entry to the physical file (not to another rule) eg to /home/contact-us.aspx not /contact-us
- Inside web.config, move the new rule to the top of the rule stack
References
http://www.iis.net/learn/extensions/url-rewrite-module/rule-with-rewrite-map-rule-template