skip to Main Content

I am XAMPP on my localhost. When I go to localhost it’s redirecting me to localhost/dashboard/ That’s good.

now, I want If I type laravel.dev It’s should load the laravel public folder

For that I configure httpd-vhosts file as below:

<VirtualHost *:80>    
    DocumentRoot "D:/xampp/htdocs/"
    ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "D:/xampp/htdocs/laravel-practice/public/"
    ServerName laravel.dev
</VirtualHost>

windows hosts file like below:

127.0.0.1       localhost   
127.0.0.1       laravel.dev

now, If I go to laravel.dev it’s redirecting me to localhost/dashboard/ location. but its should be redirecting me to laravel public folder which is D:/xampp/htdocs/laravel-practice/public/

can you tell me how can I fix it?

2

Answers


  1. If everything else is ok then change * to laravel.dev

    <VirtualHost laravel.dev:80>
        DocumentRoot "D:/xampp/htdocs/laravel-practice/public/"
        ServerName laravel.dev
    </VirtualHost>
    
    Login or Signup to reply.
  2. Two important points:

    • Always restart apache after edit httpd-vhosts
    • Include NameVirtualHost laravel.dev:80 before <VirtualHost laravel.dev:80>

    UPDATE

    Xampp has a default index.php on htdocs folder, try deleting this file, because index.php redirects to /dashboard and let me know if worked

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