Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 198
  • Last Modified:

Url redirect

Hi

I have the following domain , now i have assigned ssl certificate and made the bindings available for both http and https

domain :  aa.andr.ind.com

url: http://aa.andr.ind.com

and i am Using the  following  in web.config , and IIS 7.5 version.

</system.webServer>
<rewrite>
            <rules>
                  <rule name="Redirect to HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions><add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
</rule>
            </rules>
      </rewrite>
</system.webServer>

but it is not redirecting to  https://aa.andr.ind.com  when i typed aa.andr.ind.com in browser, could you please say me what the problem with above configuration/Coding.

                    Many thanks.
0
praveen1981
Asked:
praveen1981
  • 3
  • 2
1 Solution
 
Zsolt PribuszCommented:
Just looking at your code, I spotted is that, you start with a closing </system.webServer>
Remove the unnecessary / from the first entry.
0
 
it_saigeDeveloperCommented:
Zsolt's reponse is valid but I also think your pattern is a bit *off*.  Here is an example redirect from one of my servers, i.e. -
  <system.webServer>
        <rewrite>
            <rules>
                <rule name="HTTP to HTTPs" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="off" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Found" />
                </rule>
            </rules>
        </rewrite>
  </system.webServer>

Open in new window

-saige-
0
 
praveen1981Author Commented:
Hi saige,

I have used the same as you suggested , but still no use.

is there any thing need to added ?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
it_saigeDeveloperCommented:
What does your entire web.config consist of (please modify any sensitive information like user names and/or passwords)?

Also, does the rewrite rule show in IIS for your site?Capture.JPGCapture.JPG-saige-
0
 
praveen1981Author Commented:
Hi Saige,

 Many thanks, now it working perfectly.
0
 
praveen1981Author Commented:
Many thanks
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now