Copied to clipboard

Flag this post as spam?

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


  • jonok 260 posts 476 karma points
    May 22, 2012 @ 01:20
    jonok
    0

    UrlRewriting to another domain - error 'not a valid virtual path'

    I'm trying to rewrite a path on a website to load another domain - is this possible? Using the config setting below I'm getting the this error: Exception message: 'http://otherdomain.com' is not a valid virtual path.

    Here's the UrlRewriting.config setting:

    <add name="compare"  virtualUrl="^~/path/here"  rewrite="Domain"
                        destinationUrl="http://otherdomain.com" ignoreCase="true"  />

     

    Any help would be greatly appreciated, thanks.

  • Mike Chambers 621 posts 1203 karma points c-trib
    May 22, 2012 @ 10:20
    Mike Chambers
    0

    http://our.umbraco.org/forum/developers/extending-umbraco/2600-Using-UrlRewriting-to-redirect-domain similar scenario but a redirect not a rewrite as you require.

    also has a link to the documentation www.urlrewriting.net/160/en/documentation.html :-)

    I think you may need the http://firstdomain.com in you virtualUrl as well, seen as you've specified rewrite="Domain" might you also need the trailing slash on the destinationurl?

  • jonok 260 posts 476 karma points
    May 28, 2012 @ 03:50
    jonok
    0

    Hi Mike,

    I've tried adding the domain to the virtual url, as well as adding the trailing slash to the destination url, but everything I've tried still ends in the same error. I've now setup a subdomain to use but it still isn't working. Eg:

     

    <add name="compare"  virtualUrl="http://www.domain.com/directory/?$"  rewrite="Domain"
                        destinationUrl="http://subdomain.domain.com" ignoreCase="true"  />

    The documentation doesn't give me any more info either. Has anybody successfully used rewrite="Domain"? All of the examples that I've seen use redirect="Domain".

  • Mike Chambers 621 posts 1203 karma points c-trib
    May 28, 2012 @ 10:14
    Mike Chambers
    0

    I'm wondering if you can rewrite between domains? Maybe this is disallowed to stop phishing, so for your needs you would have to change to a redirect?

  • jonok 260 posts 476 karma points
    May 29, 2012 @ 00:54
    jonok
    0

    After some researching I've come to the conclusion that this won't work with the Umbraco Url Rewriting module. The problem is that it uses  HttpContext.Current.RewritePath, and this requires a valid virtual path which can't contain a full URL, I think it has to be a relative URL. So I've now purchased ISAPI_Rewrite ( http://www.helicontech.com/isapi_rewrite/ ) which has a proxy setting that rewrites to other domains and works perfectly.

  • 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