Wamp 3.2.4 - Virtual hosts not working for Project links
Posted by: giodoc (---.skybroadband.com)
Date: January 22, 2021 01:46PM

Hi I installed 3.2.4 and added virtual hosts for each project. When I click on the link.. for some it comes back to the localhost page. For others it says page not found.

I have seen the solutions that allow to add localhost in the URL but there is no option in index.php for that.. Or on the right click menu either.

Any help would be great!

Options: ReplyQuote
Re: Wamp 3.2.4 - Virtual hosts not working for Project links
Posted by: Otomatic (Moderator)
Date: January 22, 2021 02:18PM

Hi,

What is the contents of the files:
- wamp64\bin\apache\apache2.4.xx\conf\extra\httpd-vhosts.conf
- C:\Windows\System32\drivers\etc\hosts

What is the result of:
- Right-Click -> Tools -> Show VirtualHost examined by Apache

> I have seen the solutions that allow to add localhost in the URL
NO. Very old solution totally obsolete and unsupported.

See :
The need for Virtual Host
and
Wampserver 3 - Create or add a VirtualHost
and
Why to create a VirtualHost BEFORE installing a CMS

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Wamp 3.2.4 - Virtual hosts not working for Project links
Posted by: giodoc (---.skybroadband.com)
Date: January 22, 2021 02:44PM

Thanks for the quick response Otomatic.. Firstly there are a few different versions of apache installed. I updated to 2.4.6 I think these are the contents:


Content deleted by Otomatic.
It is the content of the httpd-vhosts.conf file that is requested.

-------------------------------------------------------
VirtualHost configuration:

Default server: localhost
Virtual Host: localhost
Virtual Host: bronco
Virtual Host: rzf
Virtual Host: xxxxx
Virtual Host: xxxxlwordpress
*** WARNING: Apache VirtualHost 'bronco'
*** is not defined in C:/Windows/system32/drivers/etc/hosts file

*** WARNING: Apache VirtualHost 'rzf'
*** is not defined in C:/Windows/system32/drivers/etc/hosts file




The hosts file:

--------------------------------------------------------------
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 localhost
::1 localhost

127.0.0.1 xxxx - These sites I setup recently with as instructed in the docs as virtual host - They end up on the localhost page

127.0.0.1 xxxwordpress
::1 xxxxwordpress



Edited 1 time(s). Last edit at 01/22/2021 02:53PM by Otomatic.

Options: ReplyQuote
Re: Wamp 3.2.4 - Virtual hosts not working for Project links
Posted by: Otomatic (Moderator)
Date: January 22, 2021 02:58PM

Hi,

It is the content of httpd-vhosts.conf that is requested, not httpd.conf which has no reason to have been modified.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Wamp 3.2.4 - Virtual hosts not working for Project links
Posted by: giodoc (---.skybroadband.com)
Date: January 22, 2021 08:04PM

My apologies this is from httpd-vhosts.conf

# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
#
<VirtualHost *:80>
ServerName bronco
DocumentRoot "m:/wamp64/www/bronco_motor_corp"
<Directory "m:/wamp64/www/bronco_motor_corp/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
#
<VirtualHost *:80>
ServerName rzf
DocumentRoot "m:/wamp64/www/rzf"
<Directory "m:/wamp64/www/rzf/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
#
#


#
<VirtualHost *:80>
ServerName xxxxx
DocumentRoot "m:/wamp64/www/xxxxx"
<Directory "m:/wamp64/www/xxxxx/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>


#
<VirtualHost *:80>
ServerName georgenischalwordpress
DocumentRoot "m:/wamp64/www/georgenischal_wp_18"
<Directory "m:/wamp64/www/georgenischal_wp_18/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

Options: ReplyQuote
Re: Wamp 3.2.4 - Virtual hosts not working for Project links
Posted by: Otomatic (Moderator)
Date: January 23, 2021 08:50AM

Hi,

Your hosts file must have as content :
127.0.0.1 localhost
127.0.0.1 bronco
127.0.0.1 rzf
127.0.0.1 xxxxx
127.0.0.1 georgenischalwordpress

::1 localhost
::1 bronco
::1 rzf
::1 xxxxx
::1 georgenischalwordpress

And you will access each VilrtualHost through :
Left-Click -> Your VirtualHost -> servername
or
Wampserver home page, column Your VirtualHost, click on ServerName

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Wamp 3.2.4 - Virtual hosts not working for Project links
Posted by: giodoc (---.skybroadband.com)
Date: January 23, 2021 10:33AM

OK Thanks!.. Really appreciate you taking the time to help! - will try that

Those entries in the original host file were created by wampserver 3.2.4.. I didn't add them, as an FYI.. Perhaps someone can look into why they were created that way, and how to fix that..



Edited 1 time(s). Last edit at 01/23/2021 10:41AM by giodoc.

Options: ReplyQuote
Re: Wamp 3.2.4 - Virtual hosts not working for Project links
Posted by: giodoc (---.skybroadband.com)
Date: January 23, 2021 11:19AM

Just tried that.. Still doesn't work.. Now all the links resolve to the wampserver "localhost" page..

Options: ReplyQuote
Re: Wamp 3.2.4 - Virtual hosts not working for Project links
Posted by: Otomatic (Moderator)
Date: January 23, 2021 11:37AM

Hi,

Because hosts file is modified you have to restart Windows then Wampserver.

It works by :
Left-Click -> Your VirtualHost -> bronco or other ServerName.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Wamp 3.2.4 - Virtual hosts not working for Project links
Posted by: giodoc (---.skybroadband.com)
Date: January 23, 2021 11:54AM

Hi Thanks.

The problem was, I had multiple versions of apache host, PHP and MySQL servers installed. The wamp server was picking up a previous apache version, and a previous PHP. So I right clicked on the wamp icon, went to tools and deleted unused versions. And then selected reinstall all services.. And bam! - It's all working now.

Thanks so much for your help!

Options: ReplyQuote


Sorry, only registered users may post in this forum.