.htaccess redirects https:// to https://www.

CSparkes said:
Ahh ok makes sense now, Not had to do it that way for https://domain to the www. Have had to take the http:// to https:// but thats it so cant be of help!

Yeah was the British Kitesurfing Tour stop. Same weekend as the Races.

We had our evening party there and have to say was god little bar! Great fun with all of us lot with the Buckaroo! Hve you lived in Ayr along time?

Ah I see, I thought I saw kites down the beach recently...that explains it. I'm round the far end of the bay by the castle, so I look out my office window right across to the town centre end of the beach.

Lived here all my life, with the exception of 3 years in Glasgow and 1 in London.

Darren said:
Code:
RewriteEngine onRewriteCond %{HTTPS_HOST} !^www\.RewriteRule ^(.*)$ [URL="http://www.%%7BHTTPS_HOST%7D/$1"]http://www.%{HTTPS_HOST}/$1[/URL] [R=301,L]

Thanks Darren, unfortunately that doesn't work either.
 
Sorry, it looks like I forgot to add a "s" to the http(s) of the redirected URL. (Modified an existing non ssl one)

Try this;

1.
Code:
RewriteEngine onRewriteCond %{HTTPS_HOST} !^www\.RewriteRule ^(.*)$ [URL]https://www.%{HTTPS_HOST}/$1[/URL] [R=301,L]

or for both;

2.
Code:
RewriteEngine onRewriteCond %{HTTP_HOST} !^www\.RewriteRule ^(.*)$ [URL="http://www.%{HTTP_HOST}/$1"][COLOR=#0066cc]http://www.%{HTTP_HOST}/$1[/COLOR][/URL] [R=301,L]RewriteCond %{HTTPS_HOST} !^www\.RewriteRule ^(.*)$ [URL]https://www.%{HTTPS_HOST}/$1[/URL] [R=301,L]

Edit: If that does not work can you let me know what you are seeing or point me to a URL so I can look. i.e. Are you getting a blank page, nothing at all, ignored rules or server 500 response etc. Thanks.

Edit2: [Fix] If you copied the code in 2. above and it does not work for https, then copy again. I missed the "s" once more (Doh).
 
Don't worry I noticed the missing "s". I've tried the code in Option 1 and Option 2 with no luck.

I'm wondering whether the SSL certificate is sent to the browser before the .htaccess, because no matter what I try, only the HTTP will rewrite not the HTTPS, and I'm getting "Untrusted Connection" warnings on the https:// without the www.

I've set my preference in Google Webmaster tools to www. for all the indexed pages, so hopefully the non www. one that has slipped through will be updated soon, and in that case I won't need the rewrites on the https. The whole thing has just been bloody annoying.

Thanks for the help everyone.
 
Back
Top