httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blomstrom <>
Subject [users@httpd] Can you straighten me out? (
Date Thu, 06 May 2004 23:00:33 GMT
I installed Apache, PHP and MySQL on my computer a few
months ago, using a preconfigured package from "Apache

I learned just enough about Apache to get everything
up and running and have just been focusing on PHP
since then. However, I just discovered that I may need
to change my configuration; or maybe it wasn't really
right to begin with.

For whatever it's worth, I'm using Dreamweaver and
have all my sites in a folder named sites. Thus, the
path to my site named Geobop is C:/sites/geobop, and
the path to GeoWorld is C:/sites/geoworld

When I preview a page from one of my sites, it looks
something like this:


I thought that was the "standard" and most highly
recommended configuration. But I've been trying to
figure out a better linking system, asking questions
on Dreamweaver and PHP forums, and a couple people
told me I should change my configuration, especially
if I want to work with site-root relative links.

Basically, I want to be able to insert a link that
looks something like this:


and it will work both on my local sites and online. If
I understand them correctly, my local URL should look
like http://geoworld/index.php, rather than 

I was also advised to make a LOCAL subdomain for my

I appended some instructions I was given for making
the necessary changes, with links to some Apache

But before I take the plunge, I just wanted to solicit
some advice from this list. Does it sound like I'm
doing the right thing? Do most of the pros preview
their sites as http://localhost/geoworld or
http://geoworld ?

I'd especially like to know if messing with Apache
might somehow mess up MySQL or PHP. They should be
unaffected, right?

I'll start reading up on this stuff now. I was just
hoping to get some feedback from people who might
catch me before I do something stupid.


* * * * * * * * * *

>>How do you create a sudbomain locally,

Depends on the server.
I assume you run an Apache (if not, then you have to
look at the manual
or some HowTos in the web), so you can do it with the
VirtualHost option
in the httpd.conf file. Two things are necessary,


This enables name-based virtual hosts for the given IP
(could also be a
* to match all IPs). The second are the settings for
the virtual host
itself (there are some more for configuring logfiles

    DocumentRoot /path/to/your/website/folder
    ServerName geoworld.localhost

This enables Apache to redirect all requests for
geoworld.localhost to
the given DocumentRoot (the directory that contains
the pages, images,
etc.). After restarting Apache it should be listening
for requests for
that new virtual server (actually it doesn't have to
be a subdomain to
localhost, you can choose whatever name you like).

Now only one thing is missing - the OS knows nothing
about the "new"
server, you have to edit the hosts-file, on W2k it's
located in
\WINNT\system32\drivers\etc. This file contains
nothing but the line     localhost

by default. Simply add another line with the IP and
name of your new
virtual server:     geoworld.localhost

Now when you enter http://geoworld.localhost in your
browser, Windows looks up the IP-address and sends the
request to the server, Apache recognizes the name
geoworld.localhost and redirects to the configured
virtual host directory.

Sounds more complicated than it actually is. Now you
have two ways for accessing your local website:


The difference is small, but important: The first is
only a directory below the domain root, while the
latter is a "real" domain, allowing site-root links.

>>So if I create a LOCAL subdomain, then publish it
online, I'll get the 
>>proper URL instead of http://geoworldNA.localhost?

Yes, links like "/images/foo.gif" will work locally
and online.

Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs 

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message