Print Reseller Scheme
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'Website Design Forum:' started by iain_darkflare, Oct 5, 2010.

  1. Hi everyone, quick question,

    Is it possible to redirect to

    If so how do I do it?

    I have no problem redirecting the non secure domains to www. but not sure how to go ahead with the HTTPS. I have googled the problem, but I couldn't find a solution that works.

    The current code for the non secure redirect in the .htaccess is

    # SEO URL SettingsRewriteEngine OnRewriteBase /RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule ^(.*)\?*$ index.php?_route_=$1 [L,QSA]RewriteCond %{HTTP_HOST} !^www\.domain\$RewriteRule (.*)$1 [R=301,L]
    ...and that all works fine.

    Would appreciate any help, I'm sure I am missing something pretty obvious, but I have never had to deal with SSL addresses before.
  2. does this work?
    redirectMatch 301 ^(.*)$ redirectMatch permanent ^(.*)$
    Info from this site
  3. No and I have tried that as https.

    I need anything after the https:// to always be prefixed with www.

    Sorry I realise I have written "redirects" above, where I should have written "rewrite".
  4. Cheers Chris, I have seen both those pages before. The second one doesn't work, and I am not sure where to start with the first one to be honest. I'm not sure which bits to use, as they seem to be for redirecting index.html to a folder.
  5. hmm... thats a pain... i'll have another looksee.
  6. Yeah tell me about it!

    Basically I had to move an ecommerce site, which is running on Opencart, and on the previous host both and worked for http and https.

    The new hosts set up a new security certificate, and it only works for www. So if you try and visit you get an untrusted connection warning, but everything works fine for, which wouldn't be a problem, except that Google has picked up one or two pages as being

    I really appreciate you looking for me, I just can't seem to find the correct solution.
  7. stupid SSL certificates... very confusing stuff.. i'll keep looking
  8. Harry

    Harry Senior Member

    My mate said (at a wild guess) that you might need buy wildcard certificates…
  9. hmmm thats even more strange that google is picking up a couple of pages without the www. very very strange.

    that was one of the things I just looked at too Harry... spooky LOL
  10. how about this?

    RewriteEngine onRewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC]RewriteRule ^(.*)$$1 [R=301,L]
  11. Just tried that it redirects to httpS://

    I've contacted my hosting company support to see if they can help, but I am not holding my breathe, as they have told me before that they can't help with any SSL related problems.

    Thanks Harry/Chris...I'll look into the wildcards if the hosting company cannot help.

    I don't know why the https has been picked up by Google was for the home page which obviously isn't generally served over a secure connection. The https is only on for the login, account and checkout pages.

    On the previous server (which was only used for 3/4 weeks) the whole site was redirected to http://domain as this is how Opencart defaulted, and that worked with the previous certificate, regardless of www. or not. So i'm guessing that is why Google has picked up some pages without the www. prefix, but I still can't see why the home page would have been picked up with https://

    If it had been picked up with http:// and no www. the redirects/rewrites would/do work fine.
  12. i'm sure that the hosting company will be able to force something for you.
  13. Greg

    Greg Active Member

    Hi Iain,

    One more suggestion for you to try...
  14. Cheers Greg, but that doesn't work either. :(

    Oh and I just got this reply from the hosting company:

    I'll have a read...
  15. CSparkes

    CSparkes Senior Member


    Would have suggested above ways so if they have not worked not quite sure.

    Just to confirm in head, you are wanting users on the http:// to actually be seeing pages on the https://

    Just wondering why a simple redirect to the correct page would not be ok?

    Also was in Ayr 2 weekends back great little town! You been to Cactus Jacks? That buckaroo is epic!
  16. No I need it to redirect to

    It has it's moments! First sign of a sunny day and the beach is packed. Was there something on or were you just passing through? Can't say I have been to Cactus Jacks, never really appealed to me.
  17. darren

    darren Member

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

    CSparkes Senior Member

    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?

Share This Page