Setting Up Apache Server Mappings for HomeSite

This information was gleaned from a number of websites and my own trials in getting this to work, but I thought it would be useful to have it in one place for other HomeSite users who may not be overly familiar with server configuration.

Why map servers? The reason I do it is because it enables me to browse and view PHP includes live right on my local machine. You can see the results of server side includes without having to post the site online, a big timesaver.

Part 1 â€“ Setting up Mappings in the Web Server

First, get the latest stable installation of Apache Server. The one I use is from XAMPP (www.xampp.com) and is exceedingly easy to set up. Install it according to the instructions. XAMPPâ€™s installation also includes MySQL, phpMyAdmin, a FileZilla server and a number of other useful tools.

Go into the install directory and look for this file:

C:/Program Files/xampp/apache/conf/httpd.conf

Open it in notepad. Scroll down about halfway until you see this section:

PHP

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

#

# Redirect: Allows you to tell clients about documents

that used to

# exist in your server's namespace, but do not anymore.

The client will makeanewrequest forthe document at its

newlocation.

# Example:

# Redirect permanent /foo http://www.example.com/bar

#

# Alias: Maps web paths into filesystem paths and is

used to# access content that does not live under the

DocumentRoot.

# Example:

# Alias /webpath /full/filesystem/path

#

# If you include a trailing / on /webpath then the

server will

# require it to be present in the URL. You will

also likely

# need to provide a section to allow access to

# the filesystem path.

Immediately after this section of code, youâ€™ll need to enter the following block of information (assuming your web files are located in a directory called â€œwebprojectsâ€ under C: ):

PHP

1

2

3

4

5

Alias/webprojects/"C:/webprojects/"

Options Indexes FollowSymLinks+Includes ExecCGI

AllowOverride None

Order allow,deny

Allow from all

Alias â€œmaps web paths into filesystem paths and is used to access content that does not live under the DocumentRoot.â€ In turn, the next section â€œallows access to the filesystem path.â€ If you want more information on the directives used within this section, visit http://httpd.apache.org/docs/2.2/mod/core.html#options.

Now you will need to enter a similar block of code for every folder you want listed as an alias (each web project folder). Keep entering them underneath the first block, as many as you need.

PHP

1

2

3

4

5

6

7

8

9

10

11

12

Alias/projectfolder1/

"C:/webprojects/projectfolder1/"

Options Indexes FollowSymLinks Includes ExecCGI

AllowOverride None

Order allow,deny

Allow from all

Alias/projectfolder2/"C:/webprojects/projectfolder2/"

Options Indexes FollowSymLinks Includes ExecCGI

AllowOverride None

Order allow,deny

Allow from all

â€¦and so on.

When youâ€™re finished entering project folders, save httpd.conf. Youâ€™ll need to stop and restart the Apache web server at this point (and any time you make changes to its configuration).

Part 2 â€“ Setting up Server Mappings in HomeSite

Open HomeSite. In the top menu, go to Options > Settings > Browse. In the window, tick the â€œEnable Server Mappingsâ€ box.

Click â€œAddâ€ to create a new server mapping. Note that if you ended a folder name with a â€œ/â€ you must also include the â€œ/â€ in this dialog.

For â€œMap Fromâ€ enter: C:\Program Files\xampp\

And for â€œMap Toâ€ enter: http://localhost/

Do this once more to also set the project directory to localhost:

For â€œMap Fromâ€ enter: C:\webprojects\

And for â€œMap Toâ€ enter: http://localhost/

Then youâ€™ll repeat this process for each project folder you entered in httpd.conf.

Map from C:\webprojects\projectfolder1

Map to http://localhost/projectfolder1/

… and so on.

Try using the â€œView External Browser Listâ€ button â€“ you should be able to see your local site in your chosen browser. What if it doesnâ€™t work? Try these potential solutions:

1) Did you stop and restart Apache Server?
2) Make sure that the formatting of folders and paths is identical in httpd.conf and in the settings in HomeSite. Did you forget a slash?
3) Make sure youâ€™re using backslashes, not forward slashes for the â€œMap fromâ€ portion of the server mappings in HomeSite.
4) Reboot your computer.