Copied to clipboard

Flag this post as spam?

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


  • Jay Dobson 75 posts 121 karma points
    Mar 17, 2011 @ 15:47
    Jay Dobson
    0

    Redirecting to another site for certain requests within Umbraco

    Hi All,

    I'm trying to separate two sites, one that has existed as a virtual directory of the main one for some time now.  I'd like to give it it's own domain name now.  Having said that, a number of users (and links within documents) will still point to the old site.

    Current structure:

    www.mysite.com/virtualapp

    What I want:

    www.mysite.com
    www.newapp.com

    I'm trying to swing this so that a user requesting something like:

    www.mysite.com/virtualapp/some/document.pdf

    Will be redirected to:

    www.newapp.com/some/document.pdf

    However, I'm having trouble working out what to put in /config/urlrewriting.config

            <add name="equinet"
                    virtualUrl="^~/virtualapp(.*)"
                    destinationUrl="http://newapp$1"
                    redirect="Domain"
                    redirectMode="Permanent"
                    rewriteUrlParameter="ExcludeFromClientQueryString"
                    ignoreCase="true"
                />

    Is this possible to do?

    Thanks,

    Jay

     

     

  • Jay Dobson 75 posts 121 karma points
    Mar 18, 2011 @ 19:51
    Jay Dobson
    0

    Hy All,

    I wanted to follow-up.  I found an ISAPI filter that does the trick:

    http://www.helicontech.com/isapi_rewrite/

    The free version let me specify rules at the server level (the limitation is that it doesn't let you specify rules at the site level) and has a GUI to use.  Easy to setup and get working.  Here's an example of the rewriting rules if anyone else should ever need it:

    RewriteEngine on
    RewriteBase /

    RewriteCond %{HTTPS} off
    RewriteCond %{HTTP:Host} ^(?:www\.)?.+?mysite\.com$
    RewriteRule ^virtualapp(.+)? http://newapp.mysite.com/$1 [R,L]

    RewriteCond %{HTTPS} on
    RewriteCond %{HTTP:Host} ^(?:www\.)?.+?mysite\.com$
    RewriteRule ^virtualapp(.+)? https://newapp.mysite.com/$1 [R,L]

    Two rules.  Each has a rewrite condition to make sure it's only applied against mysite.com and one is only applied to HTTP and one to HTTPS.  The rewrite rule just grabs everything originally requested after virtualapp and applies it to newapp.mysite.com.

    mysite.com/virtualapp/pdf/whatever.pdf becomes newapp.mysite.com/pdf/whatever.pdf

    So far I think it's all working.

    Thanks,

    Jay

     

Please Sign in or register to post replies

Write your reply to:

Draft