How to redirect website http to https by htaccess

How to redirect website http to https by htaccess

When we use SSL on our website for security purposes, we must write a rule for redirection HTTP to HTTPS, so it is straightforward. We can do this via the .htaccess file. There are some steps following:

Step1 : Create .htacess file 
Step2 Write the following code :
RewriteEngine On 
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?domain-name\.com
RewriteRule ^(.*)$ https://www.domain-name/$1 [R,L]
Step3In the place of domain-name, write your domain name and replace .com with your domain extension

Categories: web development

Trending Courses

CodeIgniter

Regular : 45 Days

Fastrack : 20 Days

Crash : 10 Days

Advance Digital Marketing

Regular : 6 Months

Fastrack : 3 Months

Crash : 2 Months

React JS

Regular : 45 Days

Fastrack : 25 Days

Crash : 15 Days

Laravel

Regular : 45 Days

Fastrack : 20 Days

Crash : 10 Days

Front End Developer

Regular : 6 Months

Fastrack : 4 Months

Crash : 2 Months

Related Blogs

Request For Demo