I have modified my Windows 10's hosts file to add an entry for a URL to lead to a given IP, as is it's intended usage.
However, this only works for connecting on http. Trying to enter the site through https does not work. Can this be solved?
I have modified my Windows 10's hosts file to add an entry for a URL to lead to a given IP, as is it's intended usage.
However, this only works for connecting on http. Trying to enter the site through https does not work. Can this be solved?
The hosts file is for domain name resolution, which is a process that takes domain names and converts them to IPs.
I have modified my Windows 10's hosts file to add an entry for a URL to lead to a given IP,
No you didn't. What you added are host entries. They only contain an IP and domain name.
127.0.0.1 localhost
192.168.0.1 my.home.router
URLs look like this:
Now that we got that out of the way ...
Trying to enter the site through https does not work. Can this be solved?
Not unless you control the destination IP's webserver. Here's why:
So let's say I do this in my hosts
file:
192.168.0.1 google.com
This means when I enter "http://google.com" in my browser, my browser will issue an HTTP request to 192.168.0.1 over the standard HTTP port (80). If I have a web server running on 192.168.0.1 and listening on port 80, it will load.
When I enter "https://google.com" in my browser, my browser will issue an HTTPS request to 192.168.0.1 over the standard HTTPS port (443). If I didn't set up my web server to deliver an HTTPS site on port 443, nothing will load and you'll see an error in your browser.
Can I make whatever is at 192.168.0.1 do anything different just by changing or setting anything in hosts file? No. Can you redirect ports in the hosts file? No. Can you redirect full URLs or change protocols in the hosts file? No.
You have to be in control of the software running on 192.168.0.1 to do anything like that.