Last active
December 20, 2015 06:59
-
-
Save ErDmKo/6090237 to your computer and use it in GitHub Desktop.
www redirect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if request.get_host().split(".")[0] == 'www': | |
return HttpResponseRedirect((request.is_secure() and "https" or "http")+ "://"+".".join(request.build_absolute_uri().split(".")[1:])) | |
server { | |
listen 80; | |
server_name www.dom.ru; | |
return 301 $scheme://dom.ru$request_uri; | |
} | |
server { | |
listen 80; | |
server_name dom.ru; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment