Support the ongoing development of Laravel.io →
posted 5 years ago
Last updated 1 year ago.
0

What is this {urlSegment} what is passing that oh how are you generating that ?

0

{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?

Last updated 5 years ago.
0

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);
});
0

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
Last updated 5 years ago.
0

So you see that's where the issue is :

This should be, double check your quotes:

'http://' . "{urlSegment}" . '.domain.com/' . "{urlSegment}"
0

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
Last updated 5 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

syscoid syscoid Joined 6 Jul 2018

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.