Welcome Guest. Please Login or Register  


You are here: Index > AMPPS > General Support > Topic : Local hosts file redirection not working



Threaded Mode | Print  

 Local hosts file redirection not working, Domain name to localhost not working (2 Replies, Read 7556 times)
Smithy
Group: Member
Post Group: Newbie
Posts: 2
Status:
Hi,

I just installed AMPPS and I really like.
However when I created a new domain the hosts file was updated as such:

127.0.0.1    something.com

I then tried to access the site but google keeps going to my external hosted site.

I tried many things like clearing DNS etc but nothing worked.

I then added www as below:
127.0.0.1    www.something.com

and now my local site is picked up.

So my question is why does AMPPS not prefix the domain name with www, and is prefixing with www causes problems with AMPPS?

Thanks in advance for any help.
IP: --   

Local hosts file redirection not working
Elizine
Group: Member
Post Group: Newbie
Posts: 32
Status:
Did you check that it works correctly?

Changes to hosts should take effect immediately, but Windows caches name resolution data so for some time the old records may be used. Open a command line (Windows+R, cmd, Enter) and type:

Code
ipconfig /flushdns

To drop the old data. To check if it works, use (assuming you have an ipv4 entry in your hosts for www.example.com, or an ipv6 entry in your hosts for ipv6.example.com):

Code
ping www.example.com -n 1
ping -6 ipv6.example.com -n 1

And see if it uses the correct IP. If yes, your hosts file is fine and the problem is elsewhere.

Also, you can reset the NetBios cache with (open the console as an admin or it will fail):

Code
nbtstat -R

You can check the current data in the DNS cache with:

Code
ipconfig /displaydns | more


-----------------------
Fully Managed Web Hosting Provider
IP: --   

Local hosts file redirection not working
Smithy
Group: Member
Post Group: Newbie
Posts: 2
Status:
Thanks for your help, your suggestions helped.
The problem I'm having now is that I created two websites and when I type something .com the index.html is found in the relevant folder but when I type www.something.com I get the folders listed and then I have to click on something.com and the website is up and running.  I entered 127.0.0.1 www.something.com in the hosts file.
What seems to be happening is that using www prefix is forcing Apache to look for the index file in the www folder and there is none.
The Apache config file has Include conf/extra/httpd-vhosts.conf and httpd-vhosts.conf has an entry to my websites so I thought Apache will go to my website folder and find the infex.html but obviously this isn't the case.
Have I misunderstood something.
Thanks again.
IP: --   

« Previous    Next »

Threaded Mode | Print  



Jump To :


Users viewing this topic
1 guests, 0 users.


All times are GMT. The time now is April 23, 2024, 7:34 pm.

  Powered By AEF 1.0.8 © 2007-2008 Electron Inc.Queries: 11  |  Page Created In:0.020