Click here to Skip to main content
15,879,095 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi guys, i need a url rewrite rule (IIS or Apache) that will rewrite each request from old domain to new domain.

Please note that it has to rewrite also subdomains and even query string, example bellow;

products.olddomain.com > products.newdomain.com<br />
www.olddomain.com/default.aspx?test=1 > www.newdomain.com/default.aspx?test=1


and not only that, it even has to keep protocol, so if there was request like this;

https://olddomain.com it should be https://newdomain.com

and please, i don't want to see examples for one subdomain, etc... i have hundrests of subdomains, which are generic, so this whole rule should be dynamic, and be able to accept all kind of links, and in any kind of form, and should "simply" switch from one domain to other, keeping link structure.

one more thing, this should be a permanent redirect

thank you in advance
Posted
Comments
GregWyatt 4-Feb-11 15:13pm    
Which version of IIS would you be using?

1 solution

The first website contains 10 tips for rewriting urls. #8 is to perserve the protocol. It also will help you with perserving the query strings(which I've only done in IIS 6.0) Sorry about asking which version of IIS earlier I saw the tag was marked IIS 7 afterwards.

http://blogs.iis.net/ruslany/archive/2009/04/08/10-url-rewriting-tips-and-tricks.aspx[^]

This is just the direct link to IIS 7 redirect module that appears in the above article.
http://www.iis.net/download/URLRewrite[^]

This is a persons blog on how to use the IIS 7 redirect module, which I have never personal used.
http://mvolo.com/blogs/serverside/pages/Redirect-requests-to-your-application-with-the-HttpRedirection-module.aspx[^]

I hope this helps and best of luck!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900