Fix for static path parsing

When a url contains a query parameter it gets incorrectly parsed
when replacing the /static portion.

This fix introduces a special case for urls with query parameters.