If a URL has moved or is pointing at the wrong location URL redirects can be created to redirect the visitor to the correct URL.
Make a list of the original URL and the new destination URL ideally using two columns in an Excel spreadsheet and send this to your Account Manager along with details of the web site you want the redirects applied to. The new URL can be on the same site or a different site and this does not have to be a Vuture website.
Example redirect list:
The first two example redirect to a different website and the third example redirects to a different page on the same website
Your Vuture team will implement the redirects by:
1. Creating a file called rewriteMaps.config in the root of your website if it doesn't exist already, or updating the existing file with a list of the redirects in the following format:
<rewriteMaps>
<rewriteMap name="Map1">
<add key="/about-us/our-people.aspx" value="http://my-new-website.com/people"" />
<add key="/contact-us/persons-name.aspx" value="http://my-new-website.com/persons-name"" />
<add key="/download/example.pdf" value="/download/example-correct.pdf" />
</rewriteMap>
</rewriteMaps>
2. Updating the web.config file of your website adding the following entry at the beginning of the <rewrite> node:
<rewriteMaps configSource="rewriteMaps.config" />
and the following entry as the beginning of the <rules> node:
<rule name="Redirect rule1 for Map1">
<match url=".*" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{Map1:{REQUEST_URI}}" pattern="(.+)" />
</conditions>
<action type="Redirect" url="{C:1}" appendQueryString="false" />
</rule>
so the rewrite section of the web.config will typically look like:
<rewrite>
<rewriteMaps configSource="rewriteMaps.config" />
<rules>
<rule name="Redirect rule1 for Map1">
<match url=".*" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{Map1:{REQUEST_URI}}" pattern="(.+)" />
</conditions>
<action type="Redirect" url="{C:1}" appendQueryString="false" />
</rule>
<rule name=".asp to .aspx" stopProcessing="true">
<match url=".asp" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_URI}" pattern="aspx" negate="true" />
</conditions>
<action type="Redirect" url="{REQUEST_URI}x" />
</rule>
<rule>.....Other rules go here
Note that any syntax errors in either file will cause the website to generate an error so test on a UAT or local website first before applying to a production website.
You will need to reload the website (e.g. by editing the web.config with a space) each time you make a change to the rewriteMaps.config
Things to look out for that can cause errors:
- Duplicate entries in rewriteMaps.config can cause the site to not load correctly
- Invalid characters in rewriteMaps.config - it is an XML file so & must be written as & and , and _ are normally written as - in Vuture page names.