Redirect From http to https using .htaccess file

Redirect your website all request from http to https. This is necessary because SSL certificates  provides data transfer and handshaking between Client and Server using encrypted form. Now days if SSL is not installed on a website then It’s not secure at all. Even Google also recommend SSL certificate and running a website without SSL impact low quality SEO.

You can achieve this by editing .htaccess file present in root folder.  If not present by default then you can create also.  htaccess file is the apache Web Server configuration file . First apache server load .htaccess file and then execute it.

If you are using Cpanel –

=> Login to Your Cpanel

=> Go To File Manager

=> Open public_html Folder

=> On Top Right hand side in corner there is settings icon . Click On that popup will open . Choose Show Hidden Files (dotfiles)  Enable.

=> Now .htaccess file is visible and you can edit it by right click and edit this.

Force all your website request from http to https – 

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


Make Your Website URL Friendly – 

You can also make your Website URL user friendly which improves your SEO and makes url pretty nice. You can use below htaccess code to redirect   to .

RewriteRule ^((?i)seo-tips)$ seotips.html [B,QSA]

If above htaccess rules not work then make sure your mod_rewrite is enable on your Apache Web Server. If you are using Cpanel then Its already enabled by default.

Thank You.

Leave a Reply

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