tags:

views:

43

answers:

4

I want to redirect all my browser request to abc.com when a request is sent to xyz.com I was able to do this by adding an entry in the hosts file under windows.

However I see that i can go to http://abc.com when i type in http://xyz.com:8080 but I cannot seem to get the same redirection over https.

I found out that you cannot mention ports in the host file. Need some help on this

+2  A: 

That's not what the hosts file is for. It's about the hosts that you are referring to. abc.com and xyz.com are hosts.

All the hosts file does is associate a host name with an IP address. Nothing else is possible.

John Saunders
yup..it seems that we cant even mention port numbers in the host file
frictionlesspulley
@friction: that's right. Hosts are just machines. The hosts file just maps a host name to an IP address, just like DNS does. Ports are not part of an IP address.
John Saunders
+1  A: 

A hosts file is DNS, which is used to resolve a domain name to an IP addresses, which has nothing to do with ports.

If you redirect from https://abc.com to https://xyz.com then they will need to be different servers with different certificates, as an SSL certificate is bound to the domain name.

Which means if you use your hosts file to lookup the ip address of abc.com when you try https://xyz.com then it wont work as the certificate will be for abc.com and wont match the hostheader https://xyz.com sent by your browser.

Chris Diver
+1  A: 

With HTTPS, it'll be to do with the security certificate - likely you can't get around that, or at least ... I hope not.

46Bit
+2  A: 

HTTPS is specifically designed so that you can't do this - not only is one of the core points of SSL/TLS that the conversation be encrypted, it also ensures that you really are talking to who you think you are, that you haven't been redirected to a fake site via DNS.

Paul Betts