Forum Discussion

Tommy_Campbell_'s avatar
Tommy_Campbell_
Icon for Nimbostratus rankNimbostratus
Mar 09, 2007

Redirect/Reverse Proxy

I've recently been asked to do some URL re-writes for some vanity domain stuff for one of our websites.

 

A user types http://vanitysitename.company.com into a browser.

 

That URL gets redirected to http://www.company.com/URLRedirect.aspx?subdomain=vanitysitename

 

When the response comes back to the browser, the user should see http://vanitysitename.company.com in the address bar of the browser with the content specific to that particular company. The .company.com part of the URL never changes, but the vanitysitename part will be different for each customer.

 

 

I've been working on this for about three days. Is this even possible?

1 Reply

  • If you don't want the client to see the change, you'll want to use a rule to rewrite the URI before the request is passed to the web server, but not actually send a redirect to the new location to the client. The browser's address bar will show whatever the address is for the link they clicked on or were redirected to.

     

     

    The overall process is pretty close to the example in this post (Click here).

     

     

    For your scenario, you can check to see if the host is vanitysitename.company.com and then change the host to www.company.com and the URI to /URLredirect?subdomain=vanitysitename. If it's only one vanityname, you should be able to hardcode the vanitysitename. Else, if it's more you can use getfield to grab the subdomain from the host header in the client request.

     

     

    Take a look at the other post and reply if you have questions.

     

     

    Aaron