Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Yovav Gad 41 posts 62 karma points
    Sep 23, 2010 @ 17:31
    Yovav Gad
    0

    How to show vanity URL using the Umbraco UrlRewritingNet.UrlRewriter.dll

    Does anyone know how to define a virtual URL using the Umbraco UrlRewritingNet.UrlRewriter.dll ?

    Currently if I use a rule to from target http://MyDir/A.aspx to http://MyDir/B.aspx it will show B.aspx URL at the address line,

    But I like it to show something like http://MyDir/MyPage

    For example, this is what I'm using now for login:

     

     

     

     

     

     

     

    <

     

     

     

     

    add name="SSL_SignIn"

     

    virtualUrl=http://(.*)/Membership/Login.aspx

     

    rewriteUrlParameter="ExcludeFromClientQueryString"

     

    destinationUrl=https://$1/Membership/Login.aspx

     

    ignoreCase="true"

     

    redirect="Domain"

    redirectMode="Permanent"

    />

    But I like it to show https://Membership/Login

    Any ideas ?

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Sep 23, 2010 @ 19:10
    Morten Bock
    0

    So you want both a redirect and a rewrite? You will probably need more than one rule to do this, but first thing you need to do is make the rewrite that lets you display the login page on the url you want:

    <add name="loginRewrite" 
        virtualUrl="https://(.*)/Membership/Login" 
        rewriteUrlParameter="ExcludeFromClientQueryString" 
        destinationUrl="https://$1/Membership/Login.aspx" 
        ignoreCase="true" />

    Then, to actually get people redirected to that url, use something like what you already have:

    <add name="loginRedirect"
        virtualUrl="http://(.*)/Membership/Login.aspx"
        rewriteUrlParameter="ExcludeFromClientQueryString"
        destinationUrl="https://$1/Membership/Login"
        ignoreCase="true"
        redirect="Domain"
        redirectMode="Permanent"/>

    And then you can set up a number of rules like the last one, to redirect the user from other urls the the loginpage you want.

    By the way, did you know that you can ask umbraco to use the directory type url's on you entire site? You can do that by going to the web.config and setting this value to true:

    <add key="umbracoUseDirectoryUrls" value="true" />
  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Sep 23, 2010 @ 19:11
    Morten Bock
    0

    And if you use the web config key, then you would not need the first "loginRewrite" rule.

  • Steve 472 posts 1216 karma points
    Aug 22, 2012 @ 16:45
    Steve
    0

    I just need a vanity URL to be redirected to my index page. How would I do that? I am new to Umbraco. Thanks!

    example :  www.mydomain/vanity

Please Sign in or register to post replies

Write your reply to:

Draft