Redirect all Requests to HTTPS://WWW with Htaccess

Redirect all Requests to HTTPS://WWW with Htaccess

If you have SSL certificate for your domain name then you can enable https for your domain so that all your visitors can visit your website through secure protocol. Here were have shared a simple htaccess code to redirect all requests to https://www version of your website. Follow these steps to know how to redirect all requests, or to with a piece of htaccess code.

Redirect all Requests to https with www using htaccess code

1. Login to cPanel > File Manager > Public_html
2. Open the file .htaccess to edit and paste the following code into it:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$$1 [R,L]

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule (.*)$1 [R=301,L]

3. Now very carefully, change to your own domain name and save the file.

After this code, all of your requests will be transferred to https://www version of the URL of your website.

Copyright © 2014-2018 All rights reserved.