# Route Rewriting

If you want to completely rewrite an existing route from Controller, Service, Repository, View, you can directly set the same route in the corresponding route of the plugin to overwrite it. For example, if you want to rewrite the homepage directly in the plugin, you can define it in the plugin front-end route /plugins/plugin/Routes/shop.php like this:

Route::get('/', function (){
    return '插件自定义首页';
})->name('home.index');

img.png

Refresh the homepage, the effect is as follows:

img.png

Of course, it can also be defined as a Controller method in the plugin, such as

Route::get('/', [CustomController::class, 'home'])->name('home.index');

Then implement CustomController and corresponding methods in the plugin according to Laravel MVC