Skip to content

Commit

Permalink
use 301 and add always_www option
Browse files Browse the repository at this point in the history
  • Loading branch information
pjhyett committed Jun 22, 2007
1 parent 87ddaf3 commit 43c6a1f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
17 changes: 0 additions & 17 deletions lib/config.yml.example
Expand Up @@ -28,21 +28,4 @@ sites:
upstream: 127.0.0.1:8020
server_name: cheat.errtheblog.com

subtlety:
upstream: 127.0.0.1:8021
server_name: subtlety.errtheblog.com

sfruby:
upstream: 127.0.0.1:8030
server_name: sfruby.org www.sfruby.org
no_www: true
root: rails

trac:
upstream: 127.0.0.1:9000
server_name: require.errtheblog.com

qa:
server_name: qa.famupdate.com
auth_file: /home/builder/conf/htpasswd
root: /home/builder/site
9 changes: 8 additions & 1 deletion lib/nginx.erb
Expand Up @@ -90,7 +90,14 @@ http {

<% if site['no_www'] %>
if ($host ~* "www") {
rewrite ^(.*)$ http://<%= site['server_name'].split.first %>$1 redirect;
rewrite ^(.*)$ http://<%= site['server_name'].split.first %>$1 permanent;
break;
}
<% end %>
<% if site['always_www'] %>
if ($host != "www.<%= site['server_name'].split.first %>") {
rewrite ^(.*)$ http://www.<%= site['server_name'].split.first %>$1 permanent;
break;
}
<% end %>
Expand Down

0 comments on commit 43c6a1f

Please sign in to comment.