I have two different routes in my web.php
Route::get('/', 'Web\DashboardController@index');
Route::get('/my-page/{alias}', 'Web\MyPageController@index');
I want to make the second page as my landing page without changing URLs. Like when visitor come to website it land to http://www.url.com/my-page/{alias}
There is multiple ways to achieve this, of which two common ones are:
Route::get('/', function () {
$alias = ...; // find an alias
return redirect()->route('mypage', ['alias' => $alias]);
});
Route::get('/my-page/{alias}', 'Web\MyPageController@index')->name('mypage');
or
Route::redirect('/', '/my-page/fixed-alias', 301);
Route::get('/my-page/{alias}', 'Web\MyPageController@index');
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.