Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add entry in windows "host file" such that it can redirect over https

Tags:

redirect

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

like image 869
frictionlesspulley Avatar asked Jul 16 '10 18:07

frictionlesspulley


People also ask

Can I specify port in hosts file?

The hosts file is for host name resolution only (on Windows as well as on Unix-like systems). You cannot put port numbers in there, and there is no way to do what you want with generic OS-level configuration - the browser is what selects the port to choose. So use bookmarks or something like that.

How do I add a website to my host file Windows 10?

Change the File ManuallyOnce in Notepad, go to File -> Open. Get to C:\Windows\System32\Drivers\etc and make sure to select All Files to find the hosts file. Now you can edit the hosts file. Add the custom IP address you've made earlier, followed by a space, then your domain name.


2 Answers

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.

like image 131
Ana Betts Avatar answered Sep 28 '22 02:09

Ana Betts


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.

like image 32
John Saunders Avatar answered Sep 28 '22 02:09

John Saunders