阻止访问/ index(默认Controller操作)

My routes.php looks like this:

Route::controller('/', 'HomeController');

The default root action is getIndex(). Typing the address [DOMAIN NAME]/index though, returns the start page as well. How do I prevent this? I want the start page to only be accessible when going to the root URI of my project (/).

I solved it like this:

Route::get('/', 'HomeController@index');

Route::controller('/', 'HomeController');

There's a reason I want a controller that takes care of all my routes :)

You are using RESTful Resource Controllers, replace it with,

 Route::get('/', 'HomeController@getIndex'); 

OTHER OPTIONS

/ refers to index method in the controller by default, you could make index refer to another method which creates the view you want like.

   Route::get('index', 'SomeController@someMethod');

in your route.php file

If you want the page to show a 404 you can use in your SomeController@someMethod

public function someMethod()
{
   App::abort(404)
 }

Or without the use of a method

 Route::get('index', function() { 
   App::abort(404) 
 })

Like pointed out in the comments, you need to blacklist the /index route. But only that one! You don't need to blacklist every route you don't want your users to see, because Laravel will handle that for every route that is not defined. But index is a special case, because you have to name the default route some name, don't you?

So long talk, short meaning: Rest assured, you will only have to blacklist each index route, if it is that important to you.