HTTP to HTTPS Redirect Permanently

Forcing the use of HTTPS:// on your site will ensure that visitors to your site are always using https://YourWebAddress.com and aren't able to access an insecure http://YourWebAddress.com URL. This is recommended since if a visitor does access your site as http://YourWebAddress.com everything will be marked as "Not Secure".

Below code is for forcing HTTPs on an Apache webserver. If you are using another webserver such as lighttpd, nginx, etc you will need to contact your web hosting provider for assistance.

Add the following code to the .htaccess file in your webhosting account using File Manager in Public_html Directory:

RewriteCond %{HTTP_HOST} YourWebAddress\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://YourWebAddress.com/$1 [R,L]

 

Once this change is made your site will no longer be accessible on the insecure "http://YourWebAddress.com" URLs and all visitors will be redirected to "https://YourWebAddress.com" instead.

  • ssl, auto ssl, http to https, https redirection, .htaccess, force https, hostic tutorials
  • 20 användare blev hjälpta av detta svar
Hjälpte svaret dig?