Question

How Can i setup virtual host for laravel-4 ? Previously I wrote some code and routes looked like -

Route::get('/', 'PageController@home');

Route::get('/home', 'PageController@about');

when I gave the url - "http://localhost/laravel-master/public/" I can see the home page but when tired "http://localhost/laravel-master/public/about" i got error saying url not found.

I tired configuring virtual host but ended up with the error - You don't have permission to access"url" on this server.

What is the correct way to do this ??

the path to my laravel folder is "C:\wamp\www\laravel-master"

and instead of using "http://localhost/laravel-master/public/" i wish to use url like "myapp" or so, So that when i use myapp I can see the home page and when I use "myapp/about" I can see the about page.

Was it helpful?

Solution

You need to add your virtualhost and host file.Make your apache listen to your Url.

Something like in your virtualhost file

<VirtualHost laravel>
  DocumentRoot "C:/wamp/www/laravel-master/public"
  ServerName laravel
</VirtualHost>

And in your host file:

  127.0.0.2  laravel

make apache restart and your clean URL will work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top