Changes between Initial Version and Version 2 of Ticket #25878


Ignore:
Timestamp:
Dec 7, 2015, 7:45:41 AM (8 years ago)
Author:
dong-won kang
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #25878

    • Property Type UncategorizedBug
  • Ticket #25878 – Description

    initial v2  
    2121        host = request.get_host()
    2222
     23        redirect = False
    2324        if settings.PREPEND_WWW and host and not host.startswith('www.'):
    2425            host = 'www.' + host
     26            redirect = True
    2527
    2628        # Check if we also need to append a slash so we can do it all
     
    2830        if self.should_redirect_with_slash(request):
    2931            path = self.get_full_path_with_slash(request)
     32            redirect = True
     33        else:
     34            path = request.get_full_path()
     35
     36        if (redirect):
    3037            return self.response_redirect_class('%s://%s%s' % (request.scheme, host, path))
    3138}}}
     
    3643
    3744thanks for reading
     45
     46PS changed a little - previous code won't work with prepending WWW
Back to Top