1

We are migrating web host and I wonder if it is possible in the migration phase to do a CNAME forward from https://address1.com to http://address2.com. Would the certificate still work even if the new domain doesn't have SSL yet?

1
  • 2
    To answer the second question - the certificate won't work as it's tied to the domain name. You'll have to buy a new one. Commented Feb 10, 2012 at 9:32

2 Answers 2

1

Yes it's possible to do the forward, but it won't work, you'd need a new certificate as @paulmorriss points out in the comments.

4
  • 1
    If there's a delay in getting your CA-signed certificate, you can temporarily used a self-signed certificate. This will throw up warnings in the browser unfortunately, but it is the best thing for protecting the user. Commented Feb 10, 2012 at 10:35
  • @Lèsemajesté I did not know you could do that - is there a tutorial you know of on setting such a thing up? Commented Feb 10, 2012 at 10:38
  • 1
    I've never set it up on a Windows system, but on Linux it's fairly easy. Here's a good tutorial for that. If you're using shared hosting, then you'll have to go through your hosting admin panel to install the certificate, though many web hosts will generate & install it for you when you enable HTTPS on a domain without purchasing a signed cert. Commented Feb 10, 2012 at 10:43
  • @Lèsemajesté great tip, cheers. Commented Feb 10, 2012 at 10:44
1

A CNAME record does not "forward" anything, nor does it have anything to do with either HTTP or HTTPS protocols.

A CNAME record basically tells your nameserver that the record is an alias for another (A) record and it should lookup the value for that. For example:

example.com. IN CNAME example.net.

Would make your nameserver query example.net A-record, which could be like:

example.net. IN A 127.0.0.1

If you want to redirect from one domain to another, with a different protocol, you will have to instruct either your webserver or the visitor's browser to redirect the request. There are some ways to do that.

  1. (Apache only) Create an .htaccess file in your DocumentRoot with a rule like:

    Redirect / http://example.net/

  2. Place an index.html file in your DocumentRoot with a META refresh to the secondary domain:

    <meta http-equiv="refresh" content="0;url=http://example.net/">

  3. Do something similar, but with a scripting language like PHP, for example an index.php file with:

    <?php header('Location: http://example.net/'); exit; ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.