DromFive DromFive - 6 months ago 22
PHP Question

Error 404 on localhost with wampserver

I've been using wamp for 2 weeks at my work without any problem, but now I've some issues :

localhost/phpmyadmin
is working well, but
localhost/
and
127.0.0.1
gives me a
404
error :


Not Found
The requested URL / was not found on this server.


I already tested the port
80
and it's used by
Apache
.

I have virtual hosts that works well but I can't create a new one anymore, it won't work, I don't know why.

I've searched a lot on internet but all I can find is solution that just does not work for me so if you could help me, that would be fantastic.

EDIT : I just changed my httpd-vhosts.conf, I had a mistake in my new vhosts, so now they work well, but I still have an error 404 on localhost/.

EDIT : Thank you RiggsFolly for the help, I needed to had localhost in my httpd-vhosts.conf

Answer

Ok, this sounds like the browser is trying to use the IPV6 network but you have not entered the IPV6 loopback address into the hosts file

Amend your hosts file to be

127.0.0.1 localhost
127.0.0.1 other.dev
127.0.0.1 other2.dev

::1 localhost
::1 other.dev
::1 other2.dev

The ::1 is the IPV6 loopback address just as 127.0.0.1 is the IPV4 loopback address.

You say you have Virtual Hosts setup, did you also define one, the first one for localhost. Once a Virtual Host is defined the default in httpd.conf for localhost is ignored.

So add this to the top of httpd-vhosts.conf

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot c:/wamp/www
    <Directory  "c:/wamp/www/">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

Change c: to whatever drive you installed WAMPServer onto.

Comments