redirecting Https to http using .htaccess?

webbhost

New Member
Hi all,

I want to set up a facebook tab with some basic info (opening hours for multiple locations), however facebook requires both a https and http link for users.

I've read that I can get the server to redirect https to http via the below code in the .htaccess file - but it isn't working for me.

Code:
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS} off
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]

Can anyone help me to figure out why this doesn't work?

I've tried putting it in both public_html directory .htaccess, and the directory above that (my root directory for hosting).

Thanks on advance for anyone who can shed some light!
 

webbhost

New Member
having a play, I can point a http to https page - just not the other way around.

Is a https site stored in a different location from a http page?

When it redirects to https is says page does not exist?
 

Robert-B

Member
This code works fine for me in my htaccess file

RewriteEngine on
RewriteOptions inherit

RewriteCond %{HTTP_HOST} ^exampledomain.co.uk$
RewriteRule ^(.*)$ "http://www.exampledomain.co.uk$1" [R=301,L]
 
Last edited:

chrishirst

Well-Known Member
Staff member
Or you could check the request port

Code:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
 
Top