Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

newbie question

Status
Not open for further replies.

mistergoomba

Programmer
Apr 10, 2006
9
US
i just set up apache and would like to use it locally on my laptop to set up web sites. putting localhost into my browser address bar brings up the directory /htdocs. is there a way to set it up so if i typed in in my address bar it will take me to /htdocs/example1

told ya i was a newbie ;}
 
Look for the Directive "DocumentRoot".

Change this to /htdocs, and that should change where the default documents are stored.

gene
 
thanks, now what i would really like to do is set up multiple document roots. similar to setting the virtualhost so that roots to htdocs/example1 and roots to htdocs/example2. ive read up on serveralias hoping that would work, but am not having any luck.

what i really need this for is so i can work on php/mysql scripts without having to upload them to a server. i have several websites and would like to access, run, and test them locally. i'd have no problem just setting up htdocs/example1 and running except whenever i refer to the root directory (IE: a href="/index.php") it will go to htdocs/index.php rather than htdocs/example1/index.php
 
ok, i think im getting it.

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot ../htdocs/!shortfuse
ServerName shortfuse
ServerAlias shortfuse
</VirtualHost>

i've put that in my config file, however whenever i put in the address bar, it searches goes outside the netword (eventually turning to google for a website)
 
Hi

There should be something tho point the browser to the local web server for that address. The simplest way is the hosts file. ( /etc/hosts on Linux, c:\windows\hosts on Windows '9x )
Code:
127.0.0.1        localhost shortfuse

Feherke.
 
so close! shortfuse now goes to htdocs rather than htdocs/!shortfuse

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "C:/Program Files/xampp/htdocs"
ServerName localhost
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Program Files/xampp/htdocs/!shortfuse"
ServerName shortfuse
</VirtualHost>
 
i used the server restart exe that came with the apache, didnt work, but restarting my computer did! good enough for me. thanks alot. youre my hero!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top