I have a url like this:
http://example.com/en/search
Now I want to check the first segment of the url like
$lang = Request::segment(1);
And I want to remove the $lang segment if it matches to the certain conditions. I'm retieving the url like this
$url = Request::fullUrl();
Now I want to reconstruct the url to something like this
http://example.com/search
Please note I cannot use str_replace because it searches in all parts of the url, I just want to search and replace in the first segment.