Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have set up my virtual hosts with xampp.

I uncommented the vhosts line in the httpd.conf file and added the virtual hosts in the vhosts document. The files for the web pages are located in my htdocs folder (two separate folders for each page within the htdocs folder, was using the Documents folder but had permission errors).

I changed the hosts file as well, but when I try to access the page using 'http://pagename.local' instead of getting the page, I get an index which says:

Index of /

Name etc etc etc

pagename.local1

So i believe its giving me the index of the folder instead of the page?

My vhosts conf looks like this:

<VirtualHost 127.0.0.1>
   DocumentRoot C:/Users/xxxxxx/Documents/xampp/htdocs/pagename1
   ServerName pagename1.local
</VirtualHost>

<VirtualHost 127.0.0.1>
   DocumentRoot C:/Users/xxxxxx/Documents/xampp/htdocs/pagename2
   ServerName pagename2.local
</VirtualHost>

also if I click on the pagename1.local in the index, it does take me to the page and in the url it displays: pagename1.local/pagename1.local.

share|improve this question

migrated from stackoverflow.com Oct 23 '12 at 11:42

This question came from our site for professional and enthusiast programmers.

    
You might think about increasing your accept rate. –  alk Oct 23 '12 at 8:05
    
thank you for the advice but to be honest a lot of my questions didn't receive an answer that fixed my problem so i'm not quite sure if i should accept something or not? –  user1390754 Oct 23 '12 at 8:25
add comment

2 Answers 2

Questions:

What is the result when you in cmd do the following?

 ping pagename1.local
 ping pagename2.local

If those two pings works, this should work, if not, please look into the apache error.log

<VirtualHost *:80>
   ServerName pagename1.local
   ServerAlias pagename1.local
   DocumentRoot "C:/Users/xxxxxx/Documents/xampp/htdocs/pagename1"
   <Directory "C:/Users/xxxxxx/Documents/xampp/htdocs/pagename1">
            Order deny,allow
            Allow from all
            AllowOverride All
   </Directory>
 </VirtualHost>

 <VirtualHost *:80>
   ServerName pagename2.local
   ServerAlias pagename2.local
   DocumentRoot "C:/Users/xxxxxx/Documents/xampp/htdocs/pagename2"
   <Directory "C:/Users/xxxxxx/Documents/xampp/htdocs/pagename2">
            Order deny,allow
            Allow from all
            AllowOverride All
   </Directory>
 </VirtualHost>
share|improve this answer
    
the pinging works fine i think. i don't understand what the big piece of code there is? are you suggesting i put that into my code? –  user1390754 Oct 23 '12 at 8:26
    
replace your code width my one and restart your apache .. –  donald123 Oct 23 '12 at 8:28
    
I tried your code and it still takes me to the index. –  user1390754 Oct 23 '12 at 8:42
    
In your httpd.conf what are the values of a)ServerName, b) Listen –  donald123 Oct 23 '12 at 8:52
    
And in your httpd-vhosts.conf the only code is the above one? –  donald123 Oct 23 '12 at 8:53
show 5 more comments

Is C:/Users/xxxxxx/Documents/xampp/htdocs/pagename1/pagename1.local a file or a directory?

If it's a file, change it to index.html (or whatever your DirectoryIndex is).

If it's a directory, either change your DocumentRoot to that directory or move its contents up one level.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.