# Forzar https
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
Si el htaccess (a pesar de ser Apache) no funciona es posible que esté desactivado o deshabilitado para que funcione hay que habilitar en el servidor la directiva:
AllowOverride All
Si es un servidor que no tiene Apache entonces hay que modificar el fichero web.config:
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="Redirect to https" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
No hay comentarios:
Publicar un comentario