0

I use asp.net C# and need a to make an URL rewrite rule that maps a long URL to a short url, and keep the dynamic URL parameter (guid):

Example:

The first URL (short) should be mapped / redirected to the long url below:

Short URL:

http://www.domain.com/campaign.aspx?guid=db7b1e74-f45a-4756-945f-33e812534c09

Long URL:

http://www.domain.com/templates/sections/user/misc/campaign/freemember.aspx?guid=db7b1e74-f45a-4756-945f-33e812534c09

The GUID parameter is dynamic created, so I cannot hard code that in the rewrite rule. Hope someone can help me creating this rewrite rule :)

2 Answers 2

1

I solved this:

<rewrite>
  <rules>
    <rule name="RewriteUrl">
      <match url="^campaign/([_0-9a-z-]+)" />
      <action type="Rewrite" url="/templates/sections/user/misc/campaign/freemember?id={R:1}" />
    </rule>
  </rules>
</rewrite>
Sign up to request clarification or add additional context in comments.

Comments

0

I have not had to do this before, but maybe this will be of use to you.

https://sourceforge.net/projects/shorturl-dotnet/

1 Comment

I need to make a web.config rule that dynamically converts / maps the short url to the long url and keep the GUID parameter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.