简体   繁体   中英

Laravel routes have folder name in it

When i hit url the route needs to be configured with a prefix folder name ie "laravel/" for example For Url: http://localhost/laravel/someurl

Route::get('laravel/someurl', function () {
return "asdasd";
});

How to remove the folder name for appearing in routes

if you just want add some prefix you can use below code for group of code

Route::group(['prefix' => 'app'], function () { 
  Route::get('package_type',['as'=>'package_type','uses'=>'UserController@package_type']);
});

for getting this root you need to hit

your_url.com/app/package_type

hope this is what you need

If you want to remove folder prefix, you should set web server document root to public folder. For example, if use php-cli to run PHP simple server, use option -t to change document root:

php -S localhost:80 -t /path/to/laravel-project/public

Now, you can see that prefix is gone.

Similarly, if you use other servers such as Apache or Nginx , you only need to modify the settings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM