Jump to content

Automatically re-sending the user to an https link


svgmx5

Recommended Posts

Hi everyone, i'm having an issue, i a user to automatically be re-directed to an https link from an http link...

 

so if the user types in www.domainname.com/admin they are automatically re-directed to https://www.domainname.com/admin

 

I've done this before, and i've managed to make it to work, but i can't get it to work on this server...dont' know if its because the server is a windows and not a linux server

 

Anyway, here's the code that i'm using on the .htaccess file

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

 

The rule you've provided says "If HTTPS protocol is ON, then redirect to HTTPS."  You want a rule that says "If HTTPS is OFF, then redirect to HTTPS."  Such a rule is:

RewriteCond %{HTTPS} !on
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.