I would like to redirect one domain to another, whilst also maintaining the same folder and file request structure like so:
http://libraries.domain.net/testing/another/blah.php
https://libraries.anotherdomain.com/testing/another/blah.php
For the moment ignore the SSL part.
My first questions are the simple ones:
- How to I achieve this in my
web.configfile (IIS)? - What is this type of redirect known as?
- For my own interest, how do I do this with an
.htaccessfile aswell? You do not have to answer this as I think this question has the correct answer anyway, but just wanted it confirmed.
Please Note: If you only know the answer to question 3, please do not bother answering as my main question is regarding how to do this in IIS, not Apache.
SSL
I have left this part out so far because I am not sure if it is possible to do without receiving security errors. However, what I would like to know is how can I perform the redirect above whilst keeping a secure connection?
Obviously anotherdomain.com must have a valid SSL certificate, but does domain.com also have to have a valid one even if it is forwarding all pages?
Will having two certificates prevent any errors coming up, or will it come up with a warning saying that You are not going to where you think you are going, or something along those lines?
Would it be better to do this with DNS? Would the SSL work with DNS?
See the following:
An example, using IIS URL Rewrite:
I am not sure if this has a specific name. I just call it a domain redirect or 30x redirect.
Yes, two valid certificates from trusted Certificate Authorities will prevent errors from coming up (as long as all content on the page is also sourced from valid https links). You can also just use a single certificate, if the certificate authority offers SubjectAltName support (also known as SAN or Unified Communications Certificates).
Another thing that you can do, if you have two valid certificates and only a single IP, is use SNI, but you will need to understand that not all web clients can use SNI – so be careful. The use of SNI is going up, and I would suggest that this is becoming the preferred method as you do not have to deal with the headache of tracking domains that should be on a SAN/UCC when updating.
DNS has nothing to do with SSL. You can not trick SSL via DNS shenanigans.