apache windows 7 xampp, can't see dierctory

jackjohnson44
jackjohnson44 used Ask the Experts™
on
I set up xampp on my new windows 7 laptop which is apache and mysql.  I don't insall anything, I just copy a folder and start the apache and mysql batch files.  I am trying to set up virtual directories, which work, but only for one directory location.

Both of the following work, but they go to the same directory.  I am trying to go one directory deeper to pcw (DocumentRoot /xampp/htdocs), but I get "Object not found! The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again. "

Also, when I am at the root, I can see a folder that was already there called xampp.  I also have a folder called pcw, which I can't see.  I think this is the actual main problem.  Is there some sort of permission I need to set?

<VirtualHost pcw:80>
             DocumentRoot /xampp/htdocs
             ServerName  pcw
</VirtualHost>

<VirtualHost localhost:80>
             DocumentRoot /xampp/htdocs
             ServerName  pcw
</VirtualHost>
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
Actually something else just happened.
If in the tags above, I have the following lines, I can load a browser to both pcw and localhost.

<VirtualHost pcw:80>
             DocumentRoot /xampp/htdocs
<VirtualHost localhost:80>
             DocumentRoot /xampp/htdocs

If I change one of the directories, I can't load either localhost or pcw.
<VirtualHost pcw:80>
             DocumentRoot /xampp/htdocs/pcw
<VirtualHost localhost:80>
             DocumentRoot /xampp/htdocs

Author

Commented:
It turns out that I don't need any of that at all.  I took it all out and I can still get to both locations which all go to my C:\xampp\htdocs folder.

I did but a setting in the hosts file.  I guess I have no idea how to set up the virtual directory at all.
Let say you want to create 2 virtual directory name pcw and localhost which access by http://localhost/ and http://pcw/

localhost pointing to /xamp/htdocs
pcw pointing to /xamp/htdocs/pcw

You may need below setting in your apache configuration

<VirtualHost localhost:80>
             DocumentRoot /xampp/htdocs
             ServerName  localhost
</VirtualHost>

<VirtualHost localhost:80>
             DocumentRoot /xampp/htdocs/pcw
             ServerName  pcw
</VirtualHost>

and then please go to your explorer and open this file in your notepad
C:\Windows\System32\drivers\etc\hosts

127.0.0.1               localhost
127.0.0.1               pcw

and save it

Please restart your apache in xamp  

I think it should take care your virtual directory
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

Author

Commented:
Thanks but I am still having trouble.

For some reason, the c:\xampp\apache\conf\httpd.conf file has not impact.  pcw always points to C:\xampp\htdocs no matter what I put for
<VirtualHost localhost:80>
             DocumentRoot /xampp/htdocs
             ServerName  localhost
</VirtualHost>
<VirtualHost localhost:80>
             DocumentRoot /xampp/htdocs/pcw
             ServerName  pcw
</VirtualHost>


The only thing that seems to matter is having an entry in the hosts file.  If I put an entry in that file, and domain will point to the root localhost file.  I can't influence what directory the domain points to.

I have also restarted to make sure nothing was cached.

Thanks in advance, this is killing me.
You really need to put it in your hosts file actually because your computer will not know where "pcw" IP need to be resolved since its not real domain.

Author

Commented:
Thanks, it is in the hosts file.

That is the only file that seems to matter.

I have this:
127.0.0.1               localhost
127.0.0.1               pcw

Each url will take me to the same directory.  The httpd.conf file doesn't seem to do anything.  I can figure out how to get pcw to point to a different folder than pcw.
This is how I got it working.

NameVirtualHost localhost:80
<VirtualHost localhost:80>
    ServerAdmin me@me.com
    DocumentRoot "/xampp/htdocs"
    ServerName localhost
    ServerAlias localhost
</VirtualHost>
<VirtualHost pcw:80>
    ServerAdmin me@me.com
    DocumentRoot "/xampp/htdocs/pcw"
    ServerName pcw
    ServerAlias pcw
</VirtualHost>

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial