2

Hi I'm setting up Lavarel using a book called Laravel Starter by Shawn McCool (Packt Publishing), I've cloned the respiratory via github and have got as far as configuring my hosts file and setting up my virtual hosts. As below:

127.0.0.1 laravel.dev

<VirtualHost *:80>
ServerName laravel.dev
DocumentRoot C:/xampp/htdocs/laravel/public
</VirtualHost>

However if I visit the link http://laravel.dev I am redirected to the XAMPP page and I should be expecting the laravel splash page.

Any ideas of what I have done wrong? The document root is pointing to the correct direction as it is installed onto my localhost.

Greatly appreciate any help.

user0129e021939232
  • 6,205
  • 24
  • 87
  • 140

7 Answers7

2

In the new xampp you should use something like this:

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/laravel/public"
    ServerName laravel.dev
    ServerAlias laravel.dev
    ErrorLog "logs/laravel.log"
    CustomLog "logs/custom.laravel.log" combined
    <Directory "C:/xampp/htdocs/laravel/public">
        AllowOverride All
        Order Allow,Deny
        Allow from all
        Require all granted
    </Directory>
</VirtualHost>

edited with the right serverName. This is my own virtual host file. I also use it for Laravel.

raice
  • 182
  • 1
  • 2
  • 10
0

Go to C:\wamp\bin\apache\apache2.4.9\conf\httpd.conf and enable virtualhost by removing the #sign in front of Include conf/extra/httpd-vhosts.conf

0

Albeit an old question, I found a solution to this the hard way. Do something like this:

<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs"
ServerName localhost
<Directory "C:\xampp\htdocs">
    Require all granted
</Directory>
</VirtualHost>

This would enable the XAMPP Stack to point to the localhost correctly (I guess?) And of course don't forget your drivers\etc\hosts

127.0.0.1       localhost
127.0.0.1       laraveltest.dev

Your configuration seems fine. Just don't forget to add these two.

<VirtualHost *:80>
ServerName laraveltest.dev
ServerAdmin laraveltestp@localhost.com
DocumentRoot "D:/Workspace/Projects/Playground/laravel-test/public"
#SetEnv APPLICATION_ENV "development"
<Directory "D:/Workspace/Projects/Playground/laravel-test/public">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Order Deny,Allow
    Allow from all
    Require all granted
</Directory>
</VirtualHost>
0

In new Laravel you need to change your Apache Vhost file to stop this redirection from server. For complete guide about how to change vhost file and run your first laravel web app go to following link : <https://answerdone.blogspot.com/2018/01/how-to-solve-laravel-xampp-dashboard.html>

Ganesh Garad
  • 381
  • 2
  • 6
0

probably, it is because xampp and laravel run on the same port. If so, try changing port before you start running laravel project by this command

php artisan serve --port=8080

*8080 can be changed to any other number port you want

0

Do you have NameVirtualHost enabled? try uncomment #NameVirtualHost *:80 and see if it helps.

Amirali
  • 116
  • 7
0

I used localhost/appName/public/. This is the only way it worked for me.