-
-
Save pyzen/3803383 to your computer and use it in GitHub Desktop.
Redirect without www on Nginx and Engine Yard
This file contains hidden or 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
RewriteEngine On | |
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] | |
RewriteRule ^(.*)$ http://%1/$1 [R=301,L] |
This file contains hidden or 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
# Custom server level rewrites go here. | |
# This means that you can also enter custom rewrite locations here. | |
if ($host ~* www\.(.*)) { | |
set $host_without_www $1; | |
rewrite ^(.*)$ http://$host_without_www$1 permanent; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment