# HG changeset patch # User Steve Losh # Date 1276751405 14400 # Node ID 1ce08f2b308582cb6d8ca90d256370865474fb48 # Parent 5c54d39bce36b9d41a46e8800aa4cb80a6598358 Fuck you, nginx. diff -r 5c54d39bce36 -r 1ce08f2b3085 content/.htaccess --- a/content/.htaccess Thu Jun 17 01:09:46 2010 -0400 +++ b/content/.htaccess Thu Jun 17 01:10:05 2010 -0400 @@ -9,7 +9,8 @@ RewriteRule ^blog/entry/(\d+)/(\d\d)/\d+/([^/]*)/?$ /blog/$1/$2/$3/ [R=301,L] RewriteRule ^blog/entry/(\d+)/(\d)/\d+/([^/]*)/?$ /blog/$1/0$2/$3/ [R=301,L] -{% hyde_listing_page_rewrite_rules %} +RewriteCond %{REQUEST_FILENAME}/index.html -f +RewriteRule ^(.*) $1/index.html # listing pages whose names are the same as their enclosing folder's RewriteCond %{REQUEST_FILENAME}/$1.html -f @@ -19,4 +20,4 @@ RewriteCond %{REQUEST_FILENAME}.html -f RewriteRule ^.*$ %{REQUEST_FILENAME}.html -ErrorDocument 404 /404.html \ No newline at end of file +ErrorDocument 404 /404.html diff -r 5c54d39bce36 -r 1ce08f2b3085 nginx.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nginx.conf Thu Jun 17 01:10:05 2010 -0400 @@ -0,0 +1,56 @@ +server { + listen 80; + server_name www.stevelosh.com; + rewrite ^/(.*) http://stevelosh.com/$1 permanent; +} +server { + listen 80; + server_name linode.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; + } + } +} +