lundi 6 février 2017

How to force SSL and WWW in one redirect?

I'm wanting to minimise redirects whilst forcing https and www.

Trying to get...

http://example.com

...to go straight to...

https://www.example.com

... in one redirect. Not three, two, or even the 19 I had at one stage! I'm stuck at having one redirect for the www. bit, and then another redirect for the https bit.

Currently have this in my .htacess:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^example.com$

RewriteRule ^(.*)$ http://ift.tt/1droZBe [R=301]

I was about to concede defeat, feeling that it's not possible to combine two rules into one... but then I discovered Amazon.com have it implemented! Wondering how? Does this involve doing something outside of .htacess?

Screenshot of Amazon.com and their straight-to-the-point redirect




Aucun commentaire:

Enregistrer un commentaire