Reputation: 1601
To go directly to the controller on my laravel access by accessing :
http://localhost/laravel/public/home
Do i have to dont use /public ? Can I just use :
http://localhost/laravel/home
Is this because the directory is on the public folder that causes this and should be like this?
Thanks
Upvotes: 0
Views: 1648
Reputation: 19662
Depends where your instance of Laravel is located, and whether rewrite rules have been set.
Assuming your Apache/nginx document root is /my/dir/ and your public folder is /my/dir/public/ (which makes the Laravel directory /my/dir/laravel/), you will need the /public/.
However, if your root dir is /my/dir/ and your laravel folder is in /my/laravel/, you can rename public to dir and skip using the public part, as it is now mapped to the documentRoot for the webserver.
You can change all the paths in multiple places:
paths.php
file (which defines all the other paths) is in index.php
in your public folderpaths.php
, one by one. The public one is $paths["public"]. You can change this to anything you like and it will impact both Laravel and the Artisan CLI interface. Bear in mind that Laravel does a small directory transformation after the variable is set (still in that file).Upvotes: 3