Redirect website from http to https

Depending if you are hosted on linux or windows servers both methods are listed below: 

If hosted on linux server create or edit the file called .htaccess in the root of your domain folder. Change yourdomain.com to your actual domain name. 

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://www.yourdomain.com/$1 [R,L]


If hosted on windows server create or edit the file called web.config in the root of your domain folder.  Change yourdomain.com to your actual domain name.

<configuration>
<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="Permanent" url="https://www.yourdomain.com/{R:1}" />
       </rule>
    </rules>
</rewrite>
</system.webServer>
</configuration>
  • 0 A felhasználók hasznosnak találták ezt
Hasznosnak találta ezt a választ?