The function below is replacing and
&
and ?
characters but for ?
i want the replace works only when in subdirectory example.com/forum/
public static function clean($sUrl)
{
return str_replace([' ', '&', '?'], ['%20', '&', ''], $sUrl);
}
example:
https://example.com/forum/post/work/22/what-are-requirements-to-get-a-work-permit?/24
to
https://example.com/forum/post/work/22/what-are-requirements-to-get-a-work-permit/24
Here's the code that is making the forum URL:
<a href="{{ $design->url('forum', 'forum', 'post', "$topic->name,$topic->forumId,$topic->title,$topic->topicId") }}">