Hi everyone I'm new both to this site and to backend web stuff. Thank you in advance for any and all help. Like I said in my title, I have three vhosts, two of which I can point the browser towards and one that gives me a 404. localhost and site1 both work, site2 doesn't. I think I've configured httpd-vhosts.conf correctly, but here's what it looks like.

 <VirtualHost *:80>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "C:/wamp/www"
  <Directory "C:/wamp/www">
    Allow From All
    Require local
    Require ip

<VirtualHost *:80>
  ServerName  site1.localhost
  ServerAlias site1
  DocumentRoot "C:/wamp/www/site1"
  <Directory "C:/wamp/www/site1">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
    Require ip my.local.network

<VirtualHost *:80>
    ServerName site2.localhost
    DocumentRoot "c:/wamp/www/site2"
    <Directory  "c:/wamp/www/site2/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
        Require ip my.local.network

the system32/drivers/etc hosts file looks like this: localhost site1.localhost site2.localhost

Which looks okay to me.

I'm think the problem stems from my server redirects in .htaccess in the site2 directory. But, again, the syntax looks correct. It's longer in real ife, but to save space, here's a sample. (note that this is an identical file to the one currently running live on site2.com and working just fine)

RewriteEngine On
Redirect 301 /index.html /index.php
Redirect 301 /products/foo.php /products/bar.php
Redirect 301 /products/bleep.php /products/blorp.php
Redirect 301 /literature/peep.pdf /literature/poop.pdf
Redirect 301 /products/product1.php /products/prodcut2.php

I think the problem is in here somewhere because when I try to go site2/index.php, it redirects me to products/product2.php and that's when I get the 404 error.

Checking my logs, I haven't gotten any PHP errors. But the apache log shows me this error after I try to access site2.localhost:

[Fri Apr 13 16:31:41.374431 2018] [mpm_winnt:notice] [pid 10660:tid 812] AH00418: Parent: Created child process 5852
[Fri Apr 13 16:31:41.842390 2018] [mpm_winnt:notice] [pid 5852:tid 756] AH00354: Child: Starting 64 worker threads.

Why is it starting so many processes? Is that the problem? What have I created!?!?

Edit: when I point my browser to site2.localhost, I get the 404. If I point it to site2.localhost/index.php it directs me to the wampserver homepage. Don't know if that helps

  • There can be many things that can cause this. perhaps someone hacked your server. but then I see in your config file you show c:/wamp/www/site2/ for the directory tag. Remove the last slash and see if you get lucky because ending a folder name with a terminating slash can be sometimes bad. Apr 13, 2018 at 23:22
  • Compare your configurations and you will see that between site1 and site2 you are missing a ServerAlias directive. Not sure what you are trying to do, but this is not the right way to configure Apache. What is your goal? Is this for development? Is this to go live on the internet? Are you just playing? If you want this to work from another computer, this is not the way to configure the computer. Again, what is your goal?
    – closetnoc
    Apr 13, 2018 at 23:48
  • This is just for development only myself or those on the local network will access it.
    – Nilco
    Apr 14, 2018 at 4:56
  • I don't think the problem is with your VirtualHosts. The fact that you are getting a 404 and a redirect (which is returned from your website) suggests the VitualHost is working OK. Do you have other directives in your .htaccess file? RewriteEngine has nothing to do with Redirect - these belong to different modules. The code you posted looks as if it has a typo - it redirects to /products/prodcut2.php, so where is the redirect to products/product2.php coming from? (Personally, I would avoid using localhost - use a your own unique domain for each site.)
    – MrWhite
    Apr 16, 2018 at 12:12
  • 1
    Update: I removed the vhost entry for site2 and changed the default localhost directory to wamp/www/site2 everything works fine now. I don't know if that fixed the problem, but it works for me. Again, this is purely for development and will never be publicly accessible.
    – Nilco
    Apr 16, 2018 at 18:16

1 Answer 1


I would not recommend setting different DocumentRoots that are subdirectories of each other. Rather each site should have its own independent directory. I'd change your first virtual host to:

  DocumentRoot "C:/wamp/www/default"
  <Directory "C:/wamp/www/default/">

Create that directory, and move everything except site1 and site2 frow www into the default directory.

Once you do that you won't be able to access your sites as both subdirectories and subodmains. Doing so is what is causing your problems.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.