Copied to clipboard

Flag this post as spam?

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


  • Steve 472 posts 1216 karma points
    Aug 22, 2012 @ 21:17
    Steve
    0

    Redirecting a vanity URL using a wildcard?

    I am using "umbraco Manage URL" package to try to redirect a vanity URL. Is there any way to set it up to redirect to a vanity URL that doesn't have the full file extenstion like this?

    www.yourdomain.com/vanityurlpage

    Is there a way to use a wildcard to achieve this? I don't want for example www.yourdomain.com/vanityurlpage.html

  • Drew 165 posts 340 karma points
    Sep 04, 2012 @ 13:52
    Drew
    0

    Are you trying to create a vanity URL to be used for redirection?

    So if a user goes to site.com/urlhere, they get redirected to:  site.com/actual/url/here/hello/world   ?

    Or do you simply mean that you want to turn on vanity URLs across the entire site, so that pages no longer end in .ASPX?

     

    If its the former then it looks like the 'umbraco manage url' package should do the trick.
    Maybe get in touch with the package creator, Jens?

    If you don't need to give the user access to manage the redirects you can simply use a RewriteMap with your web.config, for example:

     

    <rewriteMaps>
       <rewriteMap name="StaticRewriteMap">
    <add key="/urlhere/" value="/url/to/redirect/to/here" />

    http://learn.iis.net/page.aspx/469/using-rewrite-maps-in-url-rewrite-module/ 

     

    Cheers,

    Drew 

  • Drew 165 posts 340 karma points
    Sep 04, 2012 @ 13:55
    Drew
    0

    Doh, re-reading that - the package doesn't seem to currently support wildcards.

    Rewrite maps are for 1:1 rewrites also. Where one exact URL corresponds to another exact URL.

    If you want wildcards, then your best option is to simply use a rewrite rule in your web.config, such as:
     

     

        <rule name="Redirect from Old section A">
          <match url="^about-us/OLD-SECTION-NAME/(.*)" />
         <action type="Redirect" url="about-us/NEW-SECTION-NAME/{R:1}" redirectType="Permanent" />
        </rule>


    The above rule will simply rewrite any requests for pages under about-us/OLD-SECTION-NAME/ to about-us/NEW-SECTION-NAME/, preserving the rest of the URL (such as a subpage). 

     

     

    Cheers,

     

Please Sign in or register to post replies

Write your reply to:

Draft