Msg#: 4214421 posted 6:49 pm on Oct 9, 2010 (gmt 0)
I (or rather a girl I really like) is trying to set up a local dev server on her mac. I have XAMPP installed and working. I then downloaded her current site to the local machine and can get the homepage up on localhost/thesite. I was then trying to edit the hosts file to redirect all links from http://www.example.com to localhost/thesite so that she can develop the site locally and then upload when complete (she has a really slow internet connection).
If I add the line: 127.0.0.1 www.example.com to the hosts file and then go to www.example.com on a browser I get the XAMPP hompage. That makes sense. But since the local site is really located in localhost/thesite I instead tried:
Msg#: 4214421 posted 5:02 am on Oct 10, 2010 (gmt 0)
Getting the requests to the right location is a two way process. First of all you have to map the domain name to the IP address. This is done with your first example line:
You then have to tell the Apache webserver that the documents start at the directory /thesite. You can't do this in the hosts file because that file is only used for the translation of IP addresses and domain names. You have to edit the Apache configuration file called httpd.conf and make your changes there.
In the httpd.conf file you will find a DocumentRoot tag. If you change the directory following it to the directory where you have placed your file, it should work. Be sure that the directory tree where the development files are is readable by Apache. It has to readable both on the operating system level, and with the correct Allow/Deny statements in the httpd.conf.
If you can't get the permissions right, it may be better to move the development files to the location which was originally mentioned in the DocumentRoot setting in the httpd.conf. That location should be readable by Apache.