[wp-hackers] URL to jump to the single post of a day

jidanni at jidanni.org jidanni at jidanni.org
Sat Feb 14 05:41:20 GMT 2009


While converting a static HTML site to WordPress, I have fifty URLs to
redirect via .htaccess. I should probably just hardwire them all in,
but I noticed for WordPress if there is only one match for day, etc,
the name gets expanded:
$ HEAD -Sd http://localhost/articles/index.php/2002/10/02/a
HEAD http://localhost/articles/index.php/2002/10/02/a --> 301 Moved Permanently
HEAD http://localhost/articles/index.php/2002/10/02/a-government-out-of-control --> 200 OK
So I was thinking maybe instead of 50 hardwired lines, I could just
get away with one:
RedirectMatch (articles)/(\d{4})(\d{2})(\d{2})\.html$ http://localhost/$1/index.php/$2/$3/$4
which gets to the archive for that day, good enough, but as my site
never had more than one article per day, I am looking for the magic
wildcard character I could add to the end to jump straight to the article.
I could add "/a", but not all my articles start with "a". OK, never
mind. I'll just hardwire them all in. That way I can just issue the
definite 301 redirect in one shot.


More information about the wp-hackers mailing list