Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

URL Rewrite / mapping in asp.net

Posted on 2014-12-16
2
Medium Priority
?
229 Views
Last Modified: 2014-12-19
I use the URL rewrite module in web.config to make canonical URL. That works perfect.

Now I want to make some easy "shortcut" urls that is mapped to the original long url.

Example:

If user writes http://www.example.com/contact/ that url should point to this spesific url (not redirected if possible): http://www.example.com/templates/sections/common/module.aspx?id=5790

I tried this, but no luck:

<rewrite>

  <rewriteMaps>
    <rewriteMap name="Redirects">
      <add key="/contact/" value="/templates/sctions/common/Module.aspx?id=5790" />
    </rewriteMap>
  </rewriteMaps>

  <rules>
    <rule name="CanonicalHostName" stopProcessing="true">
      <match url="(.*)" />
      <conditions>
        <add input="{HTTP_HOST}" pattern="^www\.nettdating\.no$" negate="true" />
      </conditions>
      <action type="Redirect" url="http://www.nettdating.no/{R:1}" />
    </rule>
  </rules>

</rewrite>

Open in new window


How do I make (static) friendly URLs like I try to do here?
0
Comment
Question by:webressurs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 1

Accepted Solution

by:
webressurs earned 0 total points
ID: 40508818
I solved this myselves this way:

<system.web>
    <urlMappings>
      <clear />
      <add url="~/contact" mappedUrl="~//templates/sections/common/module.aspx?id=5790" />
      <add url="~/contact/" mappedUrl="~//templates/sections/common/module.aspx?id=5790" />
    </urlMappings>
</system.web>
0
 
LVL 1

Author Closing Comment

by:webressurs
ID: 40508819
This worked perfect!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question