SimpleBits Handcrafted pixels & text from Salem, Massachusetts.
post

Bye-Bye Redirect

A month into using Tumblr for the blog and portfolio here, and I’m still happy I made the move. Something that had been bothering me was the redirect that was required for the homepage. I couldn’t point simplebits.com at Tumblr completely. If I had, over 10 years of files and old archives would’ve vanished. Setting up a subdomain avoids that, but I wanted the blog to be the main index of the site. So redirecting simplebits.com to stream.simplebits.com was the best I could do. A ProxyPass redirect might’ve solved the problem for “masking” the index—but Tumblr doesn’t support that.

I came up with a rather low-tech and sloppy solution for getting rid of the redirect that I thought I’d share in case any of you are in a similar boat. It’s sloppy, but it works well. Many thanks @frogandcode for helping with the scripty-ness.

Here’s how it works: I’m now running a crontab every five minutes that curl’s stream.simplebits.com and saves the HTML source to a temporary file on simplebits.com. The script then copies the temporary file to simplebits.com/index.html (the copy was necessary as if the curl hangs for any reason, visitors won’t get a blank file). And that’s it. The HTML source from my index on Tumblr works like a charm so long as I ensure all the paths to images and other files are absolute.

The other benefit here is that the homepage is now a flat .html file. It’s pretty damn snappy. The downside is that there’s a possibility of a post not appearing for 5 minutes after it’s published (unless you’re viewing stream.simplebits.com). But I can live with that until I’m posting breaking news. 

67 notes

  1. nhmortgagebroker reblogged this from simplebits
  2. paperbits reblogged this from simplebits and added:
    future reference; Dan has worked out...his blogging engine, without killing his old
  3. iodic reblogged this from simplebits and added:
    customizing your tumblelog URL. :)
  4. stephencaver reblogged this from simplebits and added:
    Ingenious solution,...to-do list. The drag of Tumblr has
  5. simplebits posted this
previous post next post

Elsewhere

  • RSS
  • Twitter
  • Dribbble
  • Flickr
  • Last.fm
  • Vimeo

About

SimpleBits is a tiny creative studio founded by designer, author and speaker, Dan Cederholm. We make things and occasionally write and talk about them. Contact us or learn more

Ads via the Deck

New Book