diff --git a/pywb/rewrite/templateview.py b/pywb/rewrite/templateview.py index 518df18b..208c2f4c 100644 --- a/pywb/rewrite/templateview.py +++ b/pywb/rewrite/templateview.py @@ -196,11 +196,11 @@ def get_locale_prefixes(context): orig_prefix = environ.get('pywb.app_prefix', '') coll = environ.get('SCRIPT_NAME', '') - if orig_prefix: + if orig_prefix and coll.startswith(orig_prefix): coll = coll[len(orig_prefix):] curr_loc = environ.get('pywb_lang', '') - if curr_loc: + if curr_loc and coll.startswith('/' + curr_loc): coll = coll[len(curr_loc) + 1:] for locale in loc_map.keys():