What is this {urlSegment}
what is passing that oh how are you generating that ?
{urlSegment} from controller, like this:
Route::get('{urlSegment}/commercial', 'HomeController@commercial')->name('commercial');
if we running like this, not fuction:
Route::get('/', function(){
return redirect('http://'.{urlSegment}.'.domain.com/'{urlSegment}', 301);
});
can given me solution?
Update to the following and give me the result .
Route::get('/', function(){
dd('http://'.{urlSegment}.'.domain.com/'{urlSegment}'); //die and dump here and tell me the results
return redirect('http://'.{urlSegment}.'.domain.com/'{urlSegment}', 301);
});
i try on route/web.php like this:
Route::get('/', function(){
dd('http://'.{urlSegment}.'.domain.com/'{urlSegment}'); //die and dump here and tell me the results
return redirect('http://'.{urlSegment}.'.domain.com/'{urlSegment}', 301);
});
and syntax error, unexpected '{' on:
dd('http://'.{urlSegment}.'.domain.com/'{urlSegment}'); //die and dump here and tell me the results
So you see that's where the issue is :
This should be, double check your quotes:
'http://' . "{urlSegment}" . '.domain.com/' . "{urlSegment}"
its the same not function, we added like this on route/web.php:
return redirect('http://'."{urlSegment}".'.domain.com/'."{urlSegment}", 301);
and see on browser like this:
http://%7Burlsegment1%7D.domain.com/%7BurlSegment1%7D
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community