mardi 4 août 2015

htaccess redirect for http but exclude https

I am changing the domain of a website, however due to hosting restrictions the ssl connection has to use the old domain (for the time being at least). I am therefore trying to use .htaccess to redirect from one domain to another for http connections but not for those using https.

I have the following which isn't working

RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteCond {HTTP_HOST} ^olddomain.com$ [OR]
RewriteCond {HTTP_HOST} ^www.olddomain.com$ 

RewriteRule (.*)$ http://newdomain.com/$1 [R=301,L]

Any help would be gratefully received. Thanks.

Aucun commentaire:

Enregistrer un commentaire