How can I redirect URL from www.myapp.co
to myapp.co
? And also if the URL has other parameter like www.myapp.co/other-parameter
will be redirected to myapp.co/other-parameter
where the other-parameter
can be anything. Sorry for this noob question, I am still 1 week in using Laravel.
BTW, I am using dynamic subdomain so I need only the redirect www to non-www and not the other subdomains.
Route::group(array('domain' => 'myapp.co'), function() {
Route::get('/', function() {
return 'Hello! Welcome to main page...';
});
Route::get('/login', function() {
return 'Login';
});
Route::get('/signup', function() {
return 'Signup';
});
});
Route::group(array('domain' => '{account}.myapp.co'), function() {
Route::get('/', function($account) {
if ($account == 'www') {
return Redirect::to('http://myapp.co');
}
return $account;
});
});