Solved

How to send any request to https

Posted on 2014-12-04
5
95 Views
Last Modified: 2014-12-27
HI

I have got typical problem in URL rewrite. the scenario is as mentioned below.

I have got domain abc.com and standard certificate procured  is in the name of www.abc.com. I have configured IIS with rules which takes any request (e.g. http://abc.com or http://www.abc.com) to https://www.abc.com and this is working fine.

however, when I tried accessing https://abc.com it gives certificate invalid error. my URL write rules are attached herewith.

The server is hosting  multiple sites and need to bind the SSL for abc.com and expected result is smooth error-free access of https://www.abc.com no matter how it is typed (e.g. http://www.abc.com, http://bac.com, https://abc.com and of course https://www.abc.com)

Pls. suggest the options possible without changing the SSL certificate.

web.config
0
Comment
Question by:Mickail
  • 3
  • 2
5 Comments
 
LVL 14

Expert Comment

by:Edwin Hoffer
ID: 40480408
Hello Mickail,

Try the below code:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <clear />
                <rule name="Redirect to https" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                    </conditions>
                    <action type="Redirect" url="https://www.abc.com" redirectType="Permanent" appendQueryString="false" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

Open in new window


Thanks
Edwin
0
 

Author Comment

by:Mickail
ID: 40481358
Hi Edwin

really appreciate for the response. however, still the problem remains the same.

let me re-iterate it again.

1. the ssl cert is in the name of www.abc.com
2. the website should be accessible without any certificate error  and go to https://www.abc.com thru any of the following URLs.
http://www.abc.com (it works with your rule)
http://abc.com (it works with your rule)
https://www.abc.com (it works with your rule)

Exception
http://abc.com  (its giving certificate error and does not go to https://www.abc.com works with your rule)

hope I am able to explain the situation clearly.

best regards.
0
 
LVL 14

Expert Comment

by:Edwin Hoffer
ID: 40482226
Hello Mickail,

Try the below code:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <clear />
                <rule name="Redirect to https" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                    </conditions>
                    <action type="Redirect" url="https://www.abc.com" redirectType="Permanent" appendQueryString="false" />
                </rule>
				<rule name="Redirect to WWW" stopProcessing="true">
					<match url=".*" />
					<conditions>
						<add input="{HTTP_HOST}" pattern="^abc.com$" />
					</conditions>
					<action type="Redirect" url="http://www.abc.com/{R:0}" redirectType="Permanent" />
				</rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

Open in new window


This will redirect non www users to www

Thanks
Edwin
0
 

Accepted Solution

by:
Mickail earned 0 total points
ID: 40512616
This also didn't workout.

Client has now dropped the idea of running the domain without https://.  So this seems now resolved.
0
 

Author Closing Comment

by:Mickail
ID: 40519466
Client has now dropped the idea of running the domain without https://.  So this seems now resolved.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

820 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