In my httaccess file on Drupal I want every URL possibility to end up redirecting to https www site org (Note the 's' and 'www')
I can get the following working:
- www.site to auto redirect to https www.site
- http www.site to redirect to https www.site
I can't get:
- https site to redirect to https www.site - instead it goes to https site
- http site to auto redirect to https www.site - instead it goes to https site
- site to auto redirect to https www.site - instead it goes to https site
Here is the httaccess code so far:
# Set "protossl" to "s" if we were accessed via https://. This is used later
# if you enable "www." stripping or enforcement, in order to ensure that
# you don't bounce between http and https.
RewriteEngine on
RewriteRule ^ - [E=protossl:s]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# If your site can be accessed both with and without the 'www.' prefix, you
# can use one of the following settings to redirect users to your preferred
# URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
#
# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/foo will be redirected to http://www.example.com/foo)
# uncomment the following:
# RewriteCond %{HTTP_HOST} .
# RewriteCond %{HTTP_HOST} !^www\. [NC]
# RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Thank you for your help