homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / WebmasterWorld / Apple Software and Technology
Forum Library, Charter, Moderators: travelin cat

Apple Software and Technology Forum

Having a lot of trouble setting up local dev server
hosts file is my current problem

5+ Year Member

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: 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: www.example.com
localhost/thesite www.example.com

neither of which worked. it just gave me the XAMPP homepage again when I went to www.example.com in my browser.

When I put the whole site into the root web folder in XAMPP and went to localhost it seemed to go straight to the online page (www.example.com)

any help would be appreciated.

[edited by: travelin_cat at 8:51 pm (utc) on Oct 9, 2010]
[edit reason] Changed example URL to example.com [/edit]



WebmasterWorld Senior Member lammert us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

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: www.example.com

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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / WebmasterWorld / Apple Software and Technology
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved