skip to Main Content

Whenever, i open localhost, it is opened as http://localhost/dashboard/. But i want when i open localhost (http://localhost/) in browser, all the list of files and directories will be show. Please anyone can tell me, how to do this.

2

Answers


  1. If you want the content under /dashboard to be available at the root on http://localhost, you need to point your site’s webroot to that directory, so it’s the entry point for your web server.

    Open /etc/apache2/conf/httpd.conf in a text editor of your choice and find

    <Directory "/var/www">

    edit the path to point to your dashboard, something like that:

    <Directory "/var/www/dashboard">

    as final step you need to restart your apache2

    sudo service apache2 restart

    Login or Signup to reply.
  2. It may happen if installation of WAMPP/LAMPP/XAMPP stack software (Windows/ Linux) is a fresh one.

    If so, in this cause it is happening due to a statement in index.php (automatically created file during installation) file which is in root folder of the fresh installation of wampp/lampp/xampp stack.

    You can simply remove/rename/ replace this index.php file or comment the following lines in index.php

    if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {
        $uri = 'https://';
    } else {
        $uri = 'http://';
    }
    //$uri .= $_SERVER['HTTP_HOST'];
    //header('Location: '.$uri.'/dashboard/');
    exit;
    

    If it is not the cause try these things in depends on your os/server

    1)create virtual host Windows xampp

    2)create virtual host apache

    3)create virtual host Lamp Linux distributions

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search