I need to redirect an entire microsite (mymicrosite.com) to relevant pages on my main site (mysite.com).

My main site has a custom 301 module (built into the 404 page) which checks unfound paths against a list of paths where we've moved a page. So if I simply redirect the entire of my microsite at domain level I can handle all the paths from it in the 301 module.

But: I want the index page for my microsite to map to mymainsite.com/section1, instead of to the domain itself.

So mymicrosite.com/product1 > Domain redirect > mymainsite.com/product1 > 404 > 301 Module > mymainsite.com/microsite-product-1


mymicrosite.com > Domain Redirect > mymainsite.com

I need

mymicrosite.com > Domain Redirect > mymainsite.com/microsite-products

Can this be done with URL rewrite, and if so, what would the regex look like that would rewrite a domain for all URLs with a domain/path structure but add a path if the URL to redirect contained ONLY the domain?


Yes, you can use the URLRewrite module.

<match url=".*"/>
        <add input="{HTTP_HOST}" pattern="mymicrosite.com" />
<action type="Redirect" url="http://mymainsite.com/microsite-products/{R:1}" 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.