Force https on apache

Avatar de Varun VermaDeveloper Diary

Force https on apache or redirect http traffic to https site. Here’s a simple configuration that can be done within the .htaccess file on the site directory (do this in the site’s root directory if https is to be enforced for the entire site).

<IfModule mod_rewrite.c>
  RewriteEngine on
  Redirect permanent / https://%{HTTP_HOST}%/
  RewriteRule %{HTTPS} !=on
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</IfModule>

Alternatively, you can modify the site configuration under /etc/apache2/sites-available/non-https-site

Ver la entrada original

Deja un comentario