Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
57 lines (45 sloc) 1.31 KB
server {
listen 80;
server_name www.stevelosh.com;
rewrite ^/(.*) http://stevelosh.com/$1 permanent;
}
server {
listen 80;
server_name stevelosh.com;
access_log /tmp/stevelosh.com.access.log;
error_log /tmp/stevelosh.com.error.log;
location / {
root /var/www/stevelosh.com/;
index index.html;
if ($request_uri ~ ^/blog/entry/\d+/\d/\d+/[^/]*/?$) {
rewrite ^/blog/entry/(\d+)/(\d)/\d+/([^/]*)/?$ /blog/$1/0$2/$3/ permanent;
break;
}
if ($request_uri ~ ^/blog/entry/\d+/\d\d/\d+/[^/]*/?$) {
rewrite ^/blog/entry/(\d+)/(\d\d)/\d+/([^/]*)/?$ /blog/$1/$2/$3/ permanent;
break;
}
if ($request_filename ~ ^.*.html$) {
rewrite ^(.*).html$ $1/ permanent;
break;
}
if (-f $request_filename) {
break;
}
if ($request_uri ~ ^.+[^/]$) {
rewrite ^/(.*)$ /$1/ permanent;
break;
}
if (-f $request_filename/index.html) {
rewrite ^(.*)/$ /$1/index.html;
break;
}
if ($request_filename ~ ^.*/$) {
rewrite ^/(.*)/$ /$1;
}
if (-f $request_filename.html) {
rewrite ^/(.*)$ /$1.html;
break;
}
}
}