How to Redirect website from http to https with .htaccess

HomepageArticlesGuideHow to Redirect website from http t...

Chrome and Firefox have started to show a warning to visitors when the SSL is not installed on the website. Additionally, Google & all major search engines also prefer sites that use https (SSL) i.e. giving better chances of ranking well in search results (SEO benefits).

There are many benefits of using SSL / https – now le’s talk about how you can get SSL for your website. You can purchase a standard SSL in the market that will roughly cost around $10/year.

Good news for Info Ki Dunya Web Hosting customers – all our web hosting packages include Free SSL and Domain, instant saving! Info Ki Dunya automatically install SSL on all its web hosting plans within 24 hours of activation of service – FREE SSL!

How to redirect all traffic from HTTP to https in 5 minutes

When your SSL is installed, the best approach is to keep a unified https link for visitors to see your site – in order to do this, add a below-given code block to .htaccess file:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [L,R=301]

(change yourdomain.com with your actual domain name)

How to add code to .htaccess file

Follow the steps given below to redirect all your traffic to https version:

  • Login to Plesk
  • Navigate to File Manager
  • From top right section, opt to “Show Hidden Files (dotfiles)
  • Find .htaccess file and select to edit (if the file doesn’t exist already, create one)
  • Add above given to .htaccess file and click “Save Changes”
  • Close the .htaccess and try your website with HTTP version and it should direct you to https version! All done!!!

Powered by WISECP