Redirect is working, Rewrite is not

Discussion in 'General troubleshooting' started by Robert, Apr 8, 2010.

  1. I have http://wheredoesthislinkgo.com/ successfully redirecting to http://www.robertgreiner.com/tools/reverseurl/

    this part works beautifully.

    However, I can't get the Rewrite to work.

    I want the resulting http://www.robertgreiner.com/tools/reverseurl/ URL to be rewritten as http://wheredoesthislinkgo.com/

    I think I'm on the right track but my Conditions are wrong.

    Pattern: (.*)

    Conditions:
    Input: (HTTP_HOST}
    Type: Matches the pattern
    Pattern: ^(.*)reverseurl(.*)$


    Rewrite URL: http://wheredoesthislinkgo.com/


    reverseurl is the name of the subfolder that holds the ASP .NET application.
    I also have the Rewrite occuring before the Redirect and the Stop Processing flag is set to false.

    Any suggestions?

    Thanks for your help.
     
  2. Ray

    Ray

    Try this instead..

    Input: (HTTP_HOST}
    Type: Matches the pattern
    Pattern: wheredoesthislinkgo\.com$

    target: /tools/reverseurl/{R:1}
     
  3. That didn't work, I'm wondering if what I'm trying to do is even possible. I can't find anything on the interwebs that shows me how.

    URL Rewrite takes an actual URL and reshapes it into something else.

    but, can you actually change the base name?

    Like, replacing http://www.robertgreiner.com/tools/reverseurl

    with http://www.wheredoesthislinkgo.com

    I guess this goes back to hosting multiple domains on the same account, and I don't see why this wouldn't work.
     
  4. Success! I have never felt so good about feeling so dumb.

    Here's what you have to do to get a second domain to successfully point to a subdirectory without having to deal with the extra folders.

    Main domain: http://robertgreiner.com
    Second domain: http://wheredoesthislinkgo.com

    Now, http:/wheredoesthislinkgo.com points to http://robertgreiner.com
    and http://robertgreiner.com/tools/reverseurl is where I want http://wheredoesthislinkgo.com to end up.

    NOTE: You ONLY use ActionType Rewrite for this, you do NOT redirect.

    Here are my settings...

    Pattern: (.*)

    Conditions
    Input: {HTTP_HOST}
    Type: Matches the pattern
    Pattern: (.*)wheredoesthislinkgo.com

    ActionType: Rewrite

    RewriteURL: tools/reverseurl/Default.aspx

    click append query string and stop processing of subsequent rules.

    now, when you go to http://wheredoesthislinkgo.com you will get the app running in tools/reverseurl without seeing it in the browser!

    I finally realized that the Rewrite URL box fills in everything after the domain. For instance, if I had {C:0} in the box, the rewrite module would actually look to point at http://wheredoesthislinkgo.com:80/wheredoesthislinkgo.com which is not what is desired.

    I hope this makes sense to all of you noobs out there who are having as much trouble with URL rewrite as me.
     
  5. Ray

    Ray

    Nice. Glad to see you got it to work.
     

Share This Page