Tabraiz Malik
Tabraiz Malik

Reputation: 1

Laravel routes have folder name in it

When i hit url the route needs to be configured with a prefix folder name i.e "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

Upvotes: 0

Views: 826

Answers (2)

Calos
Calos

Reputation: 1942

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.

Upvotes: 0

Gaurav Gupta
Gaurav Gupta

Reputation: 1698

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

Upvotes: 1

Related Questions