Where is the best place to save cakes.php in Apache web server?

I was trying to develop a web page in Dreamweaver, and then save it so that the Apache server runs it in standard browser without fail.

9 Years
Discussion Span
Last Post by diafol

At first, try it in the document root directory. Later, you can set up a virtual directory for it but for testing try the root directory of apache. The directory is named htdocs.


If you're interested in creating a few different webpages, you'll need to set up virtual directories. This isn't as scary as it sounds - you just need to make small changes to two Windows files (I assume you're using Windows).

Your default locahost directory will be (something)/htdocs.

Say you want to set up a new website called "amazing":

In Dreamweaver (in 2004 MX anyway):

1. Create New Dreamweaver Site
2. In the popup, press the Advanced tab.
3. Give the site a name (e.g. amazing).
4. Local root folder -> locate htdocs, then create a subfolder called
amazing. Select this.
5. HTTP address -> http:// localhost/amazing/ (no spaces)
6. Select Test server under the categories list on the left panel.
7. Server model -> PHP MySQL
8. Access -> Local/Network
9. Testing server folder -> C:\xampp\htdocs\amazing\
10. URL prefix -> http:// amazing.local/ (no spaces; or anything you want)

[You could fill the remote info at this point as well if you have a live website]

Be aware, this will not work yet.

Open C:\Windows\System32\drivers\etc\hosts and you should see something like:

# Copyright (c) 1993-2006 Microsoft Corp.
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
# For example:
#     rhino.acme.com          # source server
#     x.acme.com              # x client host       localhost
::1             localhost

Append the following to the end of the file:       amazing.local

This must be the same as the name you chose in part 10.

Then open the file: C:\xampp\apache\conf\extra\httpd-vhosts.conf. The location of this file may be slightly different (I'm use XAMPP). You should see something like:

# Virtual Hosts
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
# You may use the command line option '-S' to verify your virtual host
# configuration.

# Use name-based virtual hosting.
##NameVirtualHost *:80

# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
##<VirtualHost *:80>
##    ServerAdmin webmaster@dummy-host.example.com
##    DocumentRoot /www/docs/dummy-host.example.com
##    ServerName dummy-host.example.com
##    ServerAlias www.dummy-host.example.com
##    ErrorLog @rel_logfiledir@/dummy-host.example.com-error_log
##    CustomLog @rel_logfiledir@/dummy-host.example.com-access_log common

##<VirtualHost *:80>
##    ServerAdmin webmaster@dummy-host2.example.com
##    DocumentRoot /www/docs/dummy-host2.example.com
##    ServerName dummy-host2.example.com
##    ErrorLog @rel_logfiledir@/dummy-host2.example.com-error_log
##    CustomLog @rel_logfiledir@/dummy-host2.example.com-access_log common


Append the following to the end of the file:

   DocumentRoot C:\xampp\htdocs\amazing
   ServerName amazing.local

OK, that's it for the setup and file edits. You now need to stop the Apache server and then restart it. You may find that you need to do this more than once before the page displays in the browser.

The url will be http: // amazing.local/cakes.php (no spaces)

One problem I've hit with this is that I need a live internet connection even with a local site. haven't got round to working that out yet.

Hope it helps.

Edited by diafol: insert space to stop example urls from being a link

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.