WebFaction
Community site: login faq

I've recently bought an SSL Certificate for my domain domain.com (not www).
I've followed this step to redirect http://domain.com to https://domain.com and it has successfully worked.

But now if I type http://www.domain.com it goes to https://www.domain.com which shows an untrusted connection because the certificate is valid only for domain.com.

So how do I redirect https://www.domain.com to https://domain.com

asked 16 Jan '13, 02:42

epqrs's gravatar image

epqrs
16921030
accept rate: 0%

edited 01 Feb '13, 21:17

ryans's gravatar image

ryans ♦♦
5.0k42856


It's impossible.

Basically, if a visitor arrives at https://www.domain.com, then the HTTPS protocol attempts to validate that domain against your certificate, which fails. All of that happens long before your actual application is accessed, and it's your redirect application which is issuing the redirect.

There's no way to say "Don't worry about the certificate not matching; there's nothing but a redirect here." The HTTPS handshake and authentication procedure happens before anything else.

permanent link

answered 16 Jan '13, 03:11

ryans's gravatar image

ryans ♦♦
5.0k42856
accept rate: 43%

So the only solution would be, is to add an SSL Certificate for www.domain.com so that the site is accessible both ways (with or without www).

(21 Jan '13, 05:28) epqrs epqrs's gravatar image

If you've followed the directions that you linked to, just replace %{HTTP_HOST} with domain.com in your .htaccess file. This hardcodes the URL you want to redirect to instead of basing it off of whatever the user has typed in.

permanent link

answered 16 Jan '13, 08:33

chad's gravatar image

chad
11
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×85
×72
×70

question asked: 16 Jan '13, 02:42

question was seen: 3,996 times

last updated: 01 Feb '13, 21:17

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2017 PARAGON INTERNET GROUP LIMITED
WEBFACTION IS A SERVICE OF PARAGON INTERNET GROUP LIMITED
REGISTERED IN ENGLAND AND WALES 7573953 - VAT REGISTRATION NUMBER 182147021
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM