Redirect http traffic to https

Thanks to I have installed ssl certificate on most of my sites. However after installing the certificate we also need to ensure that the traffic coming to http is redirected to https.

Use the following code in your vhost.conf file or where your apache configuration for the site is stored.

  1. RewriteEngine on
  2. RewriteCond %{SERVER_NAME} [OR]
  3. RewriteCond %{SERVER_NAME}
  4. RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

Similar posts

Ravi Sagar Newsletter

Want to contact me?