Redirect HTTP to HTTPS

redirections
Spread the love

Chrome and Firefox have begun indicating uncertain alerts on locales without SSL certificates. Without SSL, your site will indicate insecure to the users. Accordingly, utilizing a SSL-encrypted association for wellbeing, openness or PCI consistence reasons is essential. It turns out to be vital to divert from HTTP to HTTPS.

Why SSL is Critical?

Keeping in mind the end goal to constrain your web movement to utilize HTTPS, alter the codes in the .htaccess record. Before we move onto diverting HTTP to HTTPS, here’s the manner by which you can alter .htaccess record. On the off chance that you definitely know skip to Redirection steps.
Editing .htaccess File
There are guidelines/mandates in the .htaccess record that advise the server the proper behavior in specific situations and straightforwardly influences how your site capacities. Normal mandates in .htaccess document:

  • Redirects
  • Rewriting URLs

Where to edit .htaccess file:

  • You can edit the file on your PC  and upload it to the server using FTP.
  • Use “Edit” mode in FTP program that will allow you to edit a file remotely/server.
  • Use a text editor and SSH to edit the file.
  • Use the File Manager in cPanel to edit the file as a code Edit.

Redirecting HTTP to HTTPS

If you already have existing code in your .htaccess, you can add this below code:

RewriteEngine On

RewriteCond %{SERVER_PORT} 80

RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]

Redirect Only a Specific Domain

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

Redirect Only a Specific Folder

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} folder
RewriteRule ^(.*)$ https://www.yourdomain.com/folder/$1 [R,L]
Note: Replace “yourdomain” with your genuine space name wherever required. Likewise, if there should arise an occurrence of the envelope, supplant/organizer with the genuine envelope name.

Leave a Reply

Your email address will not be published. Required fields are marked *

WP Twitter Auto Publish Powered By : XYZScripts.com