āļ§āļīāļ˜āļĩāļ—āļģāļāļēāļĢāļ•āļąāđ‰āļ‡āļ„āđˆāļēāđƒāļŦāđ‰ IIS āļ—āļģāļāļēāļĢ Redirect HTTP to HTTPS āđ„āļ”āđ‰āļ”āļąāļ‡āļ™āļĩāđ‰

------------------------------------------------

āļŠāļģāļŦāļĢāļąāļšāļ—āđˆāļēāļ™āđƒāļ”āđ„āļĄāđˆāļĄāļĩāđ€āļĄāļ™āļđ URL Rewrite āļŠāļēāļĄāļēāļĢāļ–āļ”āļēāļ§āđŒāđ‚āļŦāļĨāļ”āļŠāđˆāļ§āļ™āđ€āļŠāļĢāļīāļĄāđ„āļ”āđ‰āļ—āļĩāđˆāļ™āļĩāđˆ
https://www.iis.net/downloads/microsoft/url-rewrite

āļŦāļĢāļ·āļ­āļ„āļĨāļīāļāļ—āļĩāđˆāļ™āļĩāđˆāđ€āļžāļ·āđˆāļ­āļ”āļēāļ§āđŒāđ‚āļŦāļĨāļ”āļ—āļąāļ™āļ—āļĩ

------------------------------------------------

1. āļ—āļģāļāļēāļĢāđ€āļ›āļīāļ”āļŦāļ™āđ‰āļēāļˆāļ­ IIS Manager āļ„āļĨāļīāļ URL Rewrite

Start > Run > inetmgr
āļŦāļĢāļ·āļ­ windows + R

2. āļāļ” Add Rule(s) > āļ„āļĨāļīāļ Blank rule > āļāļ” OK

3. āļ—āļģāļāļēāļĢāļ•āļąāđ‰āļ‡āļŠāļ·āđˆāļ­ http to https āđāļĨāļ° āļ•āļąāđ‰āļ‡āļ„āđˆāļē Match URL Pattern āļ”āļąāļ‡āļ™āļĩāđ‰

  • āđ€āļĨāļ·āļ­āļ Request URL = Matches the Pattern
  • āđ€āļĨāļ·āļ­āļ Using =  Regular Expressions 
  • āļāļĢāļ­āļāļŠāđˆāļ­āļ‡ Pattern = (.*)
  • āļ•āļīāđŠāļāļ–āļđāļāļŠāđˆāļ­āļ‡Â  Ignore case

iisred3

4. āļāļ” āđāļŠāļ”āļ‡ āđāļĨāļ° āļŠāļĢāđ‰āļēāļ‡ Conditions āđ‚āļ”āļĒāđ€āļžāļīāđˆāļĄāļ‚āđ‰āļ­āļĄāļđāļĨāļ”āļąāļ‡āļ•āļąāļ§āļ­āļĒāđˆāļēāļ‡

  1. āļāļ”āļ›āļļāđˆāļĄ Add
  2. Condition input : {HTTPS}
  3. āļ•āļąāđ‰āļ‡āļ„āđˆāļē Check if input string: Matches the Pattern
  4. Pattern: ^OFF$
  5. āļ•āļīāđŠāļ Ignore case.
  6. āļāļ”āļ›āļļāđˆāļ™Â OK

iisred4

5. āđƒāļ™āļŠāđˆāļ§āļ™āļ‚āļ­āļ‡ Action āļ•āļąāđ‰āļ‡āļ„āđˆāļē Redirect āļ”āļąāļ‡āļ™āļĩāđ‰

  • Action Type : Redirect
  • Redirect URL: https://{HTTP_HOST}{REQUEST_URI}
  • āļāļ” Apply āļ”āđ‰āļēāļ™āļ‚āļ§āļē āđ€āļžāļ·āđˆāļ­āļšāļąāļ™āļ—āļķāļāļ„āđˆāļē
    āđ€āļĄāļ·āđˆāļ­āļ—āđˆāļēāļ™āđ€āļ‚āđ‰āļēāđ€āļ§āđ‡āļšāđ„āļ‹āļ•āđŒāļ”āđ‰āļ§āļĒ http āļĢāļ°āļšāļšāļˆāļ°āļ—āļģāļāļēāļĢ Redirect URL āļ‚āļ­āļ‡āļ—āđˆāļēāļ™āđ„āļ›āļĒāļąāļ‡ HTTPS:// āđ‚āļ”āļĒāļ­āļąāļ•āđ‚āļ™āļĄāļąāļ•āļī

iisredirect5

 

- Permanent (301) – preferable type in this case, which tells clients that the content of the site is permanently moved to the HTTPS version. Good for SEO, as it brings all the traffic to your HTTPS website making a positive effect on its ranking in search engines.
- Found (302) – should be used only if you moved the content of certain pages to a new place *temporarily*. This way the SEO traffic goes in favour of the previous content’s location. This option is generally not recommended for a HTTP/HTTPS redirect.
- See Other (303) – specific redirect type for GET requests. Not recommended for HTTP/HTTPS.
- Temporary (307) – HTTP/1.1 successor of 302 redirect type. Not recommended for HTTP/HTTPS.

OPTION 2: Specify the Redirect Rule as https://{HTTP_HOST}/{R:1} and check the Append query string box. The Action type is also to be set as Redirect.

 The rule is created in IIS, but the site is still not redirected to https://

 

āļ§āļīāļ˜āļĩāļāļēāļĢāđāļāđ‰āđ„āļ‚ config āļ‚āļ­āļ‡ IIS āļ”āđ‰āļ§āļĒāļ•āļ™āđ€āļ­āļ‡


The rule is created in IIS, but the site is still not redirected to https://

Normally, the redirection rule gets written into the web.config file located in the document root directory of your website. If the redirection does not work for some reason, make sure that web.config exists and check if it contains the appropriate rule.

To do this, follow these steps:

  1. In the sites list of IIS, right-click on your site. Choose the Explore option:

    iisred6

  2. Explore will open the document root directory of the site. Check if the web.config file is there.
  3. The web.config file must have the following code block:
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <rewrite>
                <rules>
    
                   <rule name="ensurewww" stopProcessing="true">
                     <match url=".*" />
                     <conditions>
                       <add input="{CACHE_URL}" pattern="^(.+)://(?!www)(.*)" />
                     </conditions>
                     <action type="Redirect" url="{C:1}://www.{C:2}" redirectType="Permanent" />
                   </rule>
    
                    <rule name="HTTPS Redirect" stopProcessing="true">
                        <match url="(.*)" />
                        <conditions>
                            <add input="{HTTPS}" pattern="^OFF$" />
                        </conditions>
                        <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" />
                    </rule>
    
                </rules>
            </rewrite>
        </system.webServer>
    </configuration>

     

  4. If the web.config file is missing, you can create a new .txt file, put the aforementioned code there, save and then rename the file to web.config.

Reference : 

https://www.ssl.com/how-to/redirect-http-to-https-with-windows-iis-10/

 

āđ„āļ­āđ€āļĢāļĩāļĒāļĨāļĨāļĩāđˆāđ‚āļŪāļŠ
āļŠāļģāļŦāļĢāļąāļšāļāļēāļĢāļŠāļ™āļąāļšāļŠāļ™āļļāļ™ āđāļĨāļ°āļŠāđˆāļ§āļĒāđ€āļŦāļĨāļ·āļ­
http://www.ireallyhost.com/support
āļ‚āđ‰āļ­āļāļģāļŦāļ™āļ”āđƒāļ™āļāļēāļĢāđ€āļœāļĒāđāļžāļĢāđˆāļšāļ—āļ„āļ§āļēāļĄ āļ‚āđˆāļēāļ§āļŠāļēāļĢ
** āļšāļ—āļ„āļ§āļēāļĄāļ™āļĩāđ‰āļĄāļĩāļĨāļīāļ‚āļŠāļīāļ—āļ˜āļīāđŒ āđ„āļĄāđˆāļ­āļ™āļļāļāļēāļ•āļīāđƒāļŦāđ‰āļ„āļąāļ”āļĨāļ­āļ āļ—āļģāļ‹āđ‰āļģ āļ”āļąāļ”āđāļ›āļĨāļ‡āļāđˆāļ­āļ™āđ„āļ”āđ‰āļĢāļąāļšāļ­āļ™āļļāļāļēāļ• **
āđ‚āļ›āļĢāļ”āļĢāļ°āļšāļļāđāļŦāļĨāđˆāļ‡āļ—āļĩāđˆāļĄāļē āļšāļĢāļīāļĐāļąāļ— āđ€āļ­āđ‡āļāļ‹āđŒāļ•āļĢāđ‰āļē āļ„āļ­āļĢāđŒāļ›āļ­āđ€āļĢāļŠāļąāđˆāļ™ āļˆāļģāļāļąāļ” / https://www.ireallyhost.com
āļ—āļąāđˆāļ§āđ„āļ›
āļ„āļđāđˆāļĄāļ·āļ­ / āļ§āļīāļ˜āļĩāļāļēāļĢāļ•āļīāļ”āļ•āļąāđ‰āļ‡ SSL Certificate āļŠāļģāļŦāļĢāļąāļš cPanel Web Control Panel
āļšāļĢāļīāļāļēāļĢ SSL Certificate - āđ‚āļ”āļĒāđ„āļ­āđ€āļĢāļĩāļĒāļĨāļĨāļĩāđˆāđ‚āļŪāļŠ