C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
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.
Example. 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 ~/Content/Page10.aspx ~/Content/Page13.aspx ~/Content/Page25.aspx Examples for: mappedUrl ~/Content/Int-Parse-Conversion.aspx ~/Content/Post-Pre-Build-Macros.aspx ~/Content/Programming-Blogs.aspx
Example 2. 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" mappedUrl="~/Content/ASP-TreeView-Recursion.aspx"/> <add url="~/Content/Page9.aspx" mappedUrl="~/Content/Directed-Acyclic-Word-Graph.aspx"/> </urlMappings>
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.
Summary. 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.