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 127.0.0.1
</Directory>
</VirtualHost>
<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
</Directory>
</VirtualHost>
#
<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
</Directory>
</VirtualHost>
the system32/drivers/etc hosts file looks like this:
127.0.0.1 localhost
127.0.0.1 site1.localhost
127.0.0.1 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
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..htaccess
file?RewriteEngine
has nothing to do withRedirect
- 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 toproducts/product2.php
coming from? (Personally, I would avoid usinglocalhost
- use a your own unique domain for each site.)