Redirect HTTP To HTTPS Using htaccess File

Redirect HTTP To HTTPS Using htaccess File

If SSL is enabled for your entire site, you need to assure that every link pointing to your site’s HTTP version is redirected automatically to the HTTPS version.

In order to Redirect Your HTTP site to HTTPS, you need to modify your .htaccess file

Heads up!

Only make changes to your .htaccess file if you are 100% sure about what you are doing.

small wrong change in your .htaccess file can stop your site from loading.

These are the rules that You have to add to the .htaccess file:

# Redirect HTTP to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
If You Have Any Problem Or Doubts,
Please Do Ask Or Suggest In Comment.


Do Follow Us on:

Facebook.com

Twitter.com

Also Checkout: React Native Material date picker component

 

About: Aakash Kothari

I am passionate about my work. Because I love what I do, I have a steady source of motivation that drives me to do my best. In my last job, this passion led me to challenge myself daily and learn new skills that helped me to do better work


    Leave a Reply

    %d bloggers like this: