How To Redirect HTTP To HTTPS Right Way? Best 3 Simple Right Way 2021-2022

Please: Note That Do This Redirection Process After SSL installed And SSL will take 24 hours to install on our server after changing the name server.

1. Login to your cPanel

2. Go to File Manager

3. Then Go Root Directory Of Your Domain By Default You Have Use Main Root Domain Then Go Public_html . And If You are using The PowerHost Hosting Service Then if use multiple Domains and if your Domain is example.com so you can see example.com Folder Under File Manager so in this case your this is Domain’s Root Directory.

4. Find .htaccess file if .htaccess can not show Check “Show Hidden Files (dotfiles)”.

How To Redirect HTTP To HTTPS Right Way
How To Redirect HTTP To HTTPS Right Way

5. Click save & now yow can see the .htaccess file.

6. Right-click on the .htaccess file and click on “Edit”.

7. A box may pop up . Click the “Edit” button to continue & Edit the file.

 

How To Redirect HTTP To HTTPS Right Way?

1. Redirect All Web Traffic

Pest The Below Code

# For Redirect All Web Traffic
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]

2. Redirect Only a Specific Domain

# For 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]

 

3. Redirect Only a Specific Directory

# For Redirect Only a Specific Directory
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} folder
RewriteRule ^(.*)$ https://www.yourdomain.com/folder/$1 [R,L]

 

Note: Replace “yourdomain.com” with your domain name wherever required. Also, in the case of the folder, replace /folder with the real folder name.

Last Step

now click “Save Changes” . Test your website to make sure it is done correctly. In case, there is an error so restore the previous data and try again otherwise you can send us mail: support@thepowerhost.in we will Help You as soon as Possible

Leave a Reply

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