João Pedro Mantovani João Pedro Mantovani - 1 year ago 130
Apache Configuration Question

/Localhost is redirecting to a inside htdocs folder instead the root

When I access my localhost (or by browser I got redirect to a folder inside the root. For example:

I started my xampp, go to the browser and put instead being redirect to the htdocs root to see all my folders (projects), I'm redirect to an existing folder and can't access the anothers projects.

Anybody knows how to fix this? I searched a lot of question here but the all problems is to redirect to another folder instead of the root folder. I already checked my httpd.conf:

ServerRoot "C:/xampp/apache"

<Directory "C:/xampp/htdocs/">

After moving away my folder from the htdocs, I received the following message from the browser:

Object not found. Error 404.


I restarted my computer and not started the xampp. I can access my localhost anyway.

Answer Source

Check your hosts file for some redirections

Then you can do the next (as i do for my local projects):

  1. Create folder named localhost inside htdocs and put all standart files there

  2. create folder mynewproject.local and put some your .php there

  3. Now go to xampp/apache/conf/extra and open httpd-vhosts.conf and write

VirtualHost *:80>

DocumentRoot "C:\xampp\htdocs\localhost"
ServerName localhost


<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot "C:\xampp\htdocs\mynewproject.local"
    ServerName mynewproject.local
    ErrorLog "logs/mynewproject.local-error.log"
    CustomLog "logs/mynewproject.local-access.log" combined 
  1. Open your hosts file and add mynewproject.local

Now you can acces your project via mynewproject.local and localhost via localhost

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download