url resolving with script prefix defined

This patch fixes problem when deploying django using wsgi and apache (possibly other servers too) on sub-url.
What it does is check if resolved path is prefixed with script name (common solution when depolying on sub urls) and if so it strips it. There might be better solution but it worked in my project when everything else failed.