I’m reading the Jump Start PHP Environment and can’t seem to get chapter 3 hosts file edit example to work.
I’ve edited the hosts file as an administrator to include “126.96.36.199 www.example.com”. Except when I go to www.example.com I get a 404 page in Edge, but I get example.com in Chrome (should be google). Not sure what I’m doing wrong.
In cmd I ran “ping example.com” which returned IP 188.8.131.52, while pinging www.example.com brought back 184.108.40.206 like expected. Running example.com in edge returns example.com while running www.example.com in edge returns HTTP 404. So looks like the hosts file is working, but I can’t see to get access to the internet.
I want this to work, b/c in chapter four you make an edit ‘192.168.10.10 homestead.app’. This one returns a “Hmm, we can’t reach this page.” Error instead.
Edit: after clearing the cache and restarting Chrome I get the same 404 page.
www.example.com and example.com are two different domains. One is a subdomain of the other.
So, if you want to have single IP point to both domains in your hosts file, then you’d enter something like this.
192.168.10.10 example.com www.example.com
I’d also use that IP too. The 208 IP probably isn’t going to work and was just used as an example in the book.
The “Hmm. we can’t reach this page.” is probably the 404 page response from your VM. So, that means you are on the right track, because you are connecting with your VM. Now all you need to do is to figure out how to get the server to respond properly.
Thank you for the reply, this helped me stay on track. I was able to make my VM connection work. However, the 208 IP was suppose to send me to google. When I manually enter it it works. I tried other IP’s, and none of them seem to work. Only the one to my local host. Is this normal?
What do you mean by manually enter? If you enter the IP and domain in your hosts file, the conversion from domain name to IP should work fine.
Ah, and of course, the VM also has to be given that IP too.
Sorry, when I put the 208 IP into my web browser it takes me to google. But when I put it into my hosts file I always get a 404 error.
Yeah, don’t use the 208 IP range for development VMs. Better off with 10. 172. or 192. as they are designed to be for private networks.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.