Redirect http traffic to https

Thanks to letsencrypt.org 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} =staging.ravisagar.in [OR]
  3. RewriteCond %{SERVER_NAME} =www.staging.ravisagar.in
  4. RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

Want to contact me?

Life begins outside your comfort zone and that is where your courage is developed". Write to me by filling this form. For living I am an Atlassian Consultant who love both Jira and Drupal. I am the author of "Mastering JIRA" and "Mastering JIRA 7" books. I Love both JIRA and Drupal (a bit more). You can Write To Me and I will get back to you as soon as I can. Have a nice day!

Social Links

Subscribe to my mailing list.

Enter your email address: