PapaScott I like big blogs and I cannot lie! 🐘

Blind Dates

Now that I can do rewrites in my .htaccess file, I'm now redirecting date-based URLs to the appropriate b2 page. That means, for instace, that takes you to the monthly archive for November 2002. Before I was using hundreds of .php files generated by Movable Type, since my old hoster only allowed .htaccess files in certain directories.

This is just an interim step. I eventually want b2 to produce these URLs itself.

RewriteEngine on
# give full URL on redirects, otherwise we land at (w/o www)
# rewrite date-based URLs to b2 calls ... they all begin with [0-9]+/
# any number following a # is an individual post
RewriteRule ^(0-9)+/.+#([0-9]+)$ 
    http://%{HTTP_HOST}/index.php?p=$1&more=1&c=1 [R,L]
# YYYY/MM/DD/PPPP individual post
RewriteRule ^([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)  
    http://%{HTTP_HOST}/index.php?p=$4&more=1&c=1 [R,L]
# YYYY/MM/DD daily archive
RewriteRule ^([0-9]+)/([0-9]+)/([0-9]+) 
    http://%{HTTP_HOST}/index.php?m=$1$2$3 [R,L]
# YYYY/MM monthly archive
RewriteRule ^([0-9]+)/([0-9]+) 
    http://%{HTTP_HOST}/index.php?m=$1$2 [R,L]
# YYYY go to YYYY/01 monthly archive
RewriteRule ^([0-9]{4})/*$ 
    http://%{HTTP_HOST}/index.php?m=$101 [R,L]
# any other number, pass as is
RewriteRule ^([0-9]+)/*$ 
    http://%{HTTP_HOST}/index.php?m=$1 [R,L]
comments powered by Disqus