在PHP中获取查询字符串参数

I have a little problem regarding fetching the query string in php...

The initial URL that I used to have was like following:

www.sitename.com/?id=someid

Fetching was done with the following method:

if(!empty(htmlspecialchars($_GET["id"])) && empty($me))
    {
        $_SESSION['FriendID'] = $userId;

        return $this->redirect()->toUrl("/user/emailsignup");
    }

Now I had to add a name to the URL with slashes like this:

www.sitename.com/SomeName/?id=someid

With this URL I'm getting an error...

How can I fetch the Id now with the backslashes added to the query string, so that the If statement does its job properly??

Thanks heaps!!