Jump to content

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}

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.