After installing TeamViewer, I have changed the wampserver port to 8080, so the address is http://localhost:8080.
For the host file located at C:\WINDOWS\system32\drivers\etc\, I have also made the change as below
BEFORE
127.0.0.1 www.example.com
AFTER
127.0.0.1:8080 www.example.com
When I access http://www.example.com, it doesn’t redirect to my wampserver, how can I fix it?
The
hostsfile 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.
(Some firewall/routing software might allow outbound port redirection, but that doesn’t really sound like an appealing option for this.)