Introduction:
Redirecting your website from http:// to https:// ensures data security, builds visitor trust, and avoids “Not Secure” browser warnings. This guide explains how you can easily enforce HTTPS on your website using the .htaccess file within your Prabhu Host cPanel account.
Steps to Redirect HTTP to HTTPS Using .htaccess
Step 1: Log in to cPanel
-
Go to your Prabhu Host cPanel login page.
-
Enter your credentials to access the dashboard.
Step 2: Open File Manager
-
In the “Files” section, click on “File Manager.”
-
Choose “Web Root (public_html/)” and make sure “Show Hidden Files (dotfiles)” is enabled in the settings.
Step 3: Locate or Create the .htaccess File
-
Look for the
.htaccessfile in your website's root directory. -
If it doesn’t exist, click “+ File” and name it
.htaccess.
Step 4: Edit the .htaccess File
-
Right-click the
.htaccessfile and choose “Edit” or “Code Edit.” -
Add the following lines at the very top of the file:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Step 5: Save and Close
-
Save your changes and close the editor.
Step 6: Test the Redirect
-
Open a browser and go to
http://yourdomain.com. -
It should automatically redirect to
https://yourdomain.com.
Important Tips
-
Backup First: Always back up your
.htaccessfile before editing. -
Rule Order Matters: Place HTTPS redirection rules at the top of the file to prevent conflicts with other rewrite rules.
-
SSL Must Be Installed: Ensure your SSL certificate is active. If you're unsure, you can install free SSL via your Prabhu Host cPanel.
