Ticket #2112: strip_www.diff
File strip_www.diff, 1.3 KB (added by , 18 years ago) |
---|
-
django/conf/global_settings.py
148 148 # Whether to prepend the "www." subdomain to URLs that don't have it. 149 149 PREPEND_WWW = False 150 150 151 # Alternatively, whether to strip the "www." subdomain from URLs that have it. 152 STRIP_WWW = False 153 151 154 # List of compiled regular expression objects representing User-Agent strings 152 155 # that are not allowed to visit any page, systemwide. Use this for bad 153 156 # robots/crawlers. Here are a few examples: -
django/middleware/common.py
35 35 new_url = old_url[:] 36 36 if settings.PREPEND_WWW and old_url[0] and not old_url[0].startswith('www.'): 37 37 new_url[0] = 'www.' + old_url[0] 38 elif settings.STRIP_WWW and old_url[0] and old_url[0].startswith('www.'): 39 new_url[0] = old_url[4:] 38 40 # Append a slash if append_slash is set and the URL doesn't have a 39 41 # trailing slash or a file extension. 40 42 if settings.APPEND_SLASH and (old_url[1][-1] != '/') and ('.' not in old_url[1].split('/')[-1]):