Solved

Multi-Domain Re-direct (HTTP://* -->HTTPS://www.)

Posted on 2011-09-11
4
471 Views
Last Modified: 2012-05-12
Hi all,

I have a single IIS 7 site, responsible for three different domains.  Each domain needs to point to a different directory.  Also, I would like to automatically redirect the the "https://www" root for any requests that come in.

Domains and Mappings:
1)  domain1.com -> https://www.domain1.com/sub1/
2)  domain2.com -> https://www.domain2.com/sub1/domain2.aspx
3)  domain3.com -> https://www.domain3.com/sub1/domain3.aspx

Can anyone assist me?  I'm trying to get URL re-writing to work, but have been unsuccessful so far.  Maybe there is a better alternative?
0
Comment
Question by:ITDeptAtPCS
4 Comments
 
LVL 14

Assisted Solution

by:setasoujiro
setasoujiro earned 250 total points
ID: 36519512
0
 
LVL 1

Author Comment

by:ITDeptAtPCS
ID: 36519618
That helps for handling multiple domains within one site.  The next issue is that the certificate I have is a multidomain cert from GoDaddy.  It covers the www subdomains of the domains listed above.

I want to make sure that no matter what someone enters, they are taken to https://www.domainX.com and the appropriate path listed above.
0
 
LVL 4

Accepted Solution

by:
vaibhavjaiman earned 250 total points
ID: 36521120
Hello,

please check the below script use to rewrite the http request to https using the MS URL rewrite
You can place it under the web.config

<system.webServer>
<rewrite>
<rules>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
0
 
LVL 17

Expert Comment

by:Rovastar
ID: 36532871
For the above rewrite rule yes it will work but you need to note that "require SSL" has to be disabled in IIS. Personally I like IIS to enforce this. You can 2 sites in IIS one a http one a https site and redirect from http site to the https site.  I consider this a better solution and teh best of both worlds.

More details here at point "4. Redirect to HTTPS" in this blog by Microsoft employee, Ruslan Yakushev, who helped write the URLrewriter in IIS

http://ruslany.net/2009/04/10-url-rewriting-tips-and-tricks/
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
You might have come across a situation when you have Exchange 2013 server in two different sites (Production and DR). After adding the Database copy in ECP console it displays Database copy status unknown for the DR exchange server. Issue is strange…
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question