1ce08f2b3085

Fuck you, nginx.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Thu, 17 Jun 2010 01:10:05 -0400
parents 5c54d39bce36
children 54edeec1e4e7
branches/tags (none)
files content/.htaccess nginx.conf

Changes

--- 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
--- /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;
+        }
+    }
+}
+