From 99bbaa0090a605cfb80c9f1d7b1f86cb6b9e06f8 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Sat, 19 Jul 2008 19:32:12 +0000 Subject: [PATCH] Allow avoidance of the Apache mod_rewrite undo. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7992 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/handlers/base.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/django/core/handlers/base.py b/django/core/handlers/base.py index b1de2831b34..c2bcad10ffc 100644 --- a/django/core/handlers/base.py +++ b/django/core/handlers/base.py @@ -182,10 +182,11 @@ def get_script_name(environ): Note: this isn't used by the mod_python handler, since the equivalent of SCRIPT_NAME isn't available there. """ - # If mod_rewrite had a whack at the URL, Apache set SCRIPT_URL to - # SCRIPT_NAME before applying any rewrites. - script_url = force_unicode(environ.get('SCRIPT_URL', '')) - if script_url: - return script_url + if not environ.get('DJANGO_USE_POST_REWRITE'): + # If mod_rewrite had a whack at the URL, Apache set SCRIPT_URL to + # SCRIPT_NAME before applying any rewrites. + script_url = force_unicode(environ.get('SCRIPT_URL', '')) + if script_url: + return script_url return force_unicode(environ.get('SCRIPT_NAME', ''))