Redirect http to https with htaccess

Hello, is anybody want to know how to redirect http to https with htaccess? Here I will teaching you. Just simple step. Just open you .htaccess and copy code below

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

RewriteEngine On mean allows you to rewrite URL requests that come into your server and is based on a regular-expression parser.

RewriteCond %{SERVER_PORT} 80 mean Redirect everything served on port 80 to HTTPS URI ^. RewriteCond %{SERVER_PORT} ^80

RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L] mean Tells Apache that this like refers to a single RewriteRule.


Thank you.



Leave a comment

Get the latest update about web development.