Force https on apache

Developer 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}

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

Ver la entrada original

Deja una respuesta

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de

Estás comentando usando tu cuenta de Salir /  Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Salir /  Cambiar )

Conectando a %s