0

This question is not a duplicate of any other, please read in full. I have scoured the whole internet for answers.

We want our whole website to display as https://www

Basically https:// will not redirect to https://www

Thought i'd fixed the issue with this...

RewriteCond %{HTTP_HOST} !^www\.

RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI}$1 [R=301,L]

RewriteCond %{HTTPS} off

RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}$1

but when we do this the homepage redirects work fine but every other page has the end of the url repeated twice for example /printing.htmlprinting.html

How can we get everything to display for https://www

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
  • possible duplicate of [Need to redirect all traffic to https](http://stackoverflow.com/questions/3239739/need-to-redirect-all-traffic-to-https) – RiggsFolly Aug 02 '15 at 13:21
  • I've looked at every result on this site about this. It's not duplicate because i want it to display as https://www – David Smith Aug 02 '15 at 13:23
  • Actually you are probably right it's more likely a duplicate of this http://stackoverflow.com/questions/13977851/htaccess-redirect-to-https-www – RiggsFolly Aug 02 '15 at 13:35
  • No because http://w w w was redirecting me to https://w w w. Matter is solved and Croises answer fixed the issue. Just to reiterate the issue was that http:// & http://w w w were redirecting to https://w w w fine however https:// would not redirect to https://w w w – David Smith Aug 04 '15 at 07:37

1 Answers1

0

Use this (without final $1):

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]
Croises
  • 18,570
  • 4
  • 30
  • 47