viernes, 23 de marzo de 2012

Apache redirect some ip to https

We want to allow some ip to http an redirect the rest to https. How can we do it?

We can use mod_rewrite with these rules:

       RewriteEngine On
       RewriteCond %{REMOTE_ADDR} !^192\.168\.1\.4$
       RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}


In this case only 192.168.1.4 gets access to http, other ips will be redirected to https.

No hay comentarios: