.NET Array Collections File String Async Cast DataTable DateTime Dictionary Enum Exception For Foreach IEnumerable If IndexOf Lambda LINQ List Parse Path Process Property Regex Replace Sort Split StringBuilder Substring Switch Tuple

The urlMappings element redirects URLs to new locations. This element is part of an ASP.NET config file. It redirects Googlebot and users alike to the new locations. It is easily added to Web.config to perform this complex task.

ASHX: XML for urlMappings


We can use urlMappings, a special tag you can put in your Web.sitemap. Here is a table of some "old style" URLs that I want to map to new URLs. You can see the new URLs had SEO improvements with more keywords.

Examples for: url


Examples for: mappedUrl


Example 2

Extensible markup language: XML

You can add urlMappings by adding markup to Web.config. The "~" symbol, called a tilde, is a reference to the root of the virtual application directory. That is the root directory of your website. This example shows the urlMappings tag.

Web.config examples: XML

<urlMappings enabled="true">
    <add url="~/Content/Page22.aspx"
    <add url="~/Content/Page9.aspx"

Open Web.config. This file is part of your website project in the Solution Explorer. You will need to double-click on it. Next, find the system.web element. Locate the <system.web> element and its closing tag.

Then:Put your <urlMappings> block into a section in the middle of that section.


ASPNET web programming framework

We used urlMappings as a quick fix for redirecting requests on an ASP.NET server. There are other methods that may be more powerful. Use the RewritePath method in ASP.NET and Global.asax for a more flexible approach.