Copied to clipboard

Flag this post as spam?

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


  • Robert J. Bullock 386 posts 404 karma points
    Sep 30, 2011 @ 17:56
    Robert J. Bullock
    0

    URL Rewrite: Is This Possible?

    Hey guys, I am going to need to create a rewrite right off of the root of a site. I have a field in a database and I need to do a rewrite like this:

    http://www.mysite.com/some-dealer-name

    Which would then redirect to "/view.aspx?dealer=some-dealer-name"

    Is that even possible to redirect like that right off the site root?

    Robert

  • jc 64 posts 100 karma points
    Sep 30, 2011 @ 20:36
    jc
    1

    It should be possible. I'm thinking something ike this would work:

    <add name="YourRewriteRule" virtualUrl="^~/([0-9a-z-]+)(.aspx)?$" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/view.aspx?dealer=$1" ignoreCase="true" regexOptions="RightToLeft" />

     

    Edit: Now that I test it out, everything at the top level will get redirected unless there is some path or prefix to test for.

  • Robert J. Bullock 386 posts 404 karma points
    Sep 30, 2011 @ 22:48
    Robert J. Bullock
    0

    That would be fine I guess... except I have some subpages configured to use different hostnames. How do hostnames play into URL rewrites?

  • Robert J. Bullock 386 posts 404 karma points
    Sep 30, 2011 @ 23:53
    Robert J. Bullock
    0

    That doesn't work for me in any case... any other suggestions? This is a tricky one, URL rewrites always confuse me!

  • Robert J. Bullock 386 posts 404 karma points
    Sep 30, 2011 @ 23:56
    Robert J. Bullock
    0

    Oh wait, it does work!!! Awesome, thanks so much my friend! :-)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies