SunT
SunT

Reputation: 333

Vhost can't find server

I am following RiggsFolly answer, on this question and these examples and so far everything went well, but when I click on the vhost FF says that it can't find the server. How can this fixed? I am using Wampserver 2.5.

I get this in the adress bar : http://www.cakeprebuild.com/

httpd-vhosts.conf

<VirtualHost *:80>
DocumentRoot "c:/wamp/www"
    ServerName localhost
    ServerAlias localhost
    <Directory "c:/wamp/www">
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot /wamp/www/CakePreBuild
    ServerName www.CakePreBuild.com
    <Directory "c:/wamp/www/CakePreBuild">
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

hosts

127.0.0.1       localhost
127.0.0.1       localhost
127.0.0.1       localhost
127.0.0.1       localhost
127.0.0.1       localhost
127.0.0.1       localhost
127.0.0.1       localhost

127.0.0.1 CakePreBuild

::1 localhost
::1 CakePreBuild

Upvotes: 1

Views: 1192

Answers (2)

RiggsFolly
RiggsFolly

Reputation: 94642

Try these changes

Your VHOSTS Definition

<VirtualHost *:80>
    DocumentRoot "c:/wamp/www"
    ServerName localhost
    ServerAlias localhost
    <Directory "c:/wamp/www">
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "c:/wamp/www/CakePreBuild"
    ServerName cakeprebuild.com
    ServerAlias www.cakeprebuild.com
    <Directory "c:/wamp/www/CakePreBuild">
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

Your HOSTS file

127.0.0.1 localhost
127.0.0.1 cakeprebuild.com

::1 localhost
::1 cakeprebuild.com

Personally I would avoid using the .com tld for sites your are developing and use something like .dev. If a site actually existed called cakeprebuild.com having added that name to the HOSTS file would mean you would never be able to access the actual live site from this PC as you have redirected it to this PC.

Upvotes: 1

Beachhouse
Beachhouse

Reputation: 5052

I'm guessing wamp is not configured correctly for your vhost. FF (and chrome to a lesser degree) will try and help you out add the

'http://www.' and '.com'

around what you entered, if what you entered didn't return a result. Turn off wamp and type in 'localhost', you'll be redirected to

http://www.localhost.com

Upvotes: 0

Related Questions