简体   繁体   中英

How to access domain-specific routes on a local development environment?

In web.php I have something like this, along with the usual routes.

Route::group(['domain' => 'sub.example.com'], function () {
    Route::get('/', 'MyController@home')->name('home');
});

If I go to localhost , the browser directs me to the usual routes. How do I get to these domain specific ones? My current solution is to add an entry in the hosts file. Is there another solution that doesn't involve editing the hosts file?

You can setup your hosts file for with sudomain

Sa 127.0.0.1 sub.example.com

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