Prevent redirect of base_url when query string exists

Stripping query string from REQUEST_URI

Stripping query string from REQUEST_URI when comparing to base_url.
(cherry picked from commit 1b083e7b58c18886bd698b9ff15411e182477b08)