Weblog since 2004 on books, films, art and travel.
Subscribe to the RSS feed.


Some maintenance going on here, as I finally made the jump to PivotX, software-wise. Still some details to iron out, but mostly things should work smoothly and future-proofly again.

Except, that is, for lots of broken links to fix. In a Google-dictated move, Pivot went from URLs_like_this to URLs-like-this, and didn't bother to supply a redirect script to ease the transition.

So apologies for any dead ends you run into here. It should be a temporary nuisance.

Update: Thanks to Raph, who braved the treacherous depths of server configuration and came up with an elegant two-line solution, all the old URLs_like_this are now redirected to the new URLs-like-this.

For the record, here's the code. Add this to your .htaccess file, where 'blog' is the directory PivotX is installed in.

RewriteCond %{REQUEST_URI} blog/archive
RewriteRule (.*)_(.*) /blog/$1-$2 [R=301,L]

(Of course, use at your own risk, don't try at home, etc.)

Update: Google seems to like non-looping redirecting better, so use these 'official' rules instead:

RewriteRule ^(archive/[^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)$ /$1-$2-$3-$4-$5-$6 [R=301,L]
RewriteRule ^(archive/[^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)$ /$1-$2-$3-$4-$5 [R=301,L]
RewriteRule ^(archive/[^_]*)_([^_]*)_([^_]*)_([^_]*)$ /$1-$2-$3-$4 [R=301,L]
RewriteRule ^(archive/[^_]*)_([^_]*)_([^_]*)$ /$1-$2-$3 [R=301,L]
RewriteRule ^(archive/[^_]*)_([^_]*)$ /$1-$2 [R=301,L]

No comments

Leave a comment

(optional field)
(optional field)

To prevent automated commentspam you need to answer this question...
Remember personal info?
Hide email
Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.