Redirigir el puerto http al https en Apache

Es tan sencillo como añadir cualquiera de las siguientes soluciones al fichero httpd.conf y reiniciar nuestro servidor:

Solución 1: Esta solución te hace un chequeo del protocolo HTTPS

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Solución 2: Esta otra te cheque si el puerto es diferente al 443. Si en tu caso el puerto de SSL es diferente al 443 tendrías que cambiarlo por el tuyo.

RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [L,R]
Todos estas lineas las tienes que poner en el fichero httpd.conf.

Categorized: Uncategorized
Tagged:

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>