When we visit other sites, we may see the difference between HTTP and HTTPS in front of the URL. What is the reason for that? Originally, the URL before the https//prefix is because of the use of SSL encryption, so the advantage of the encryption is that users visit the site when the computer and the server to send and receive information between the transmission will be more secure. We install the GoDaddy SSL certificate can achieve this effect.
Of course, after the installation certificate is completed, to achieve the input domain name automatically jump to HTTPS, we also need to add code to achieve the effect. GoDaddy host has Linux and Windows, so the different operating system settings are not the same.
Linux Host
If you are using a Linux host, you need to add the following code in the root directory of your Web site (no need to create one) and save it:
Rewriteengine on
Rewritecond%{server_port} 80
Rewriterule ^ (. *) $ https://www.yourdomainname.com/$1 [r,l]
(The domain name of your site replaces the yourdomainname.com above)
Of course, if you want to specify that a file uses HTTPS, add the code (at which point the. htaccess file needs to be placed in the folder you specify):
Rewriteengine on
Rewritecond%{server_port} 80
Rewritecond%{request_uri} SomeFolder
Rewriterule ^ (. *) $ https://www.yourdomainname.com/somefolder/$1 [r,l]
(The domain name of your site replaces the yourdomainname.com above)
Windows host
GoDaddy's Windows host needs to be in the Web.config file (no need to create), and then add the following code inside the file:
<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>
The above method enables HTTP to automatically jump to HTTPS