On websites without SSL certificates, Chrome and Firefox have begun to display insecure warnings. Your website will appear unsecure to visitors if SSL is not installed. In order to ensure security, accessibility, or PCI compliance, an SSL-encrypted connection must be used. Making the switch from HTTP to HTTPS becomes crucial.
Edit the codes in the.htaccess file to make all of your web traffic use HTTPS. Here’s how to modify the.htaccess file before we discuss switching from HTTP to HTTPS. Skip to the Redirection stages if you are familiar.
Editing .htaccess File
The functionality of your website is directly impacted by the directives/instructions in the.htaccess file that inform the server what to do in specific circumstances. Ordinary directives in the.htaccess file:
- Redirects
- Rewriting URLs
Editing .htaccess in cPanel File Manager
Note: Backup your website in case something goes wrong.
- Login to cPanel
- Files > File Manager > Document Root for:
- Now select the domain name you want to access
- Check “Show Hidden Files (dotfiles)”
- Click “Go”
- After a new tab or window opens, look for the .htaccess file.
- Right click on the .htaccess file and click on “Code Edit” on the menu.
- A dialogue box may pop up asking about encoding. Click “Edit” button to continue.
- Edit the file
- “Save Changes” when done.
- Test your website to make sure it is done correctly. In case, there is an error, restore to the previous version and try again.
- Once you are done, click “Close” to close the window.
Redirecting HTTP to HTTPS
Redirect All Web Traffic
Options -Indexes
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
If you need still help then contact ChennaiHost – Best Web Hosting Company in Chennai Customer Support