Alexandra Samuel

Telling the story of social media.

Moving WordPress: redirects

June30

I recently moved my blog from http://www.alexandrasamuel.com/blog to http://www.alexandrasamuel.com. That involved not only moving my actual WordPress program files but also figuring out how to redirect visitors following outdated links to my old content.

Today the ever-helpful Boris Mann pointed out that the way I had originally set up redirects totally messed up my RSS feeds and search engine results. He pointed me towards the beauty of 301 redirects, which do a nice job of preserving past and current search results.

So for the record, here is THE simple how-to for handling redirects after moving a WordPress blog (it’s been a couple of weeks since my original move so I can’t remember the steps that were required to move the WordPress install itself, but I think there’s info out there on that.) I’m basing my example URLs here on what I just went through, i.e. moving WordPress from a subdirectory (www.yoursite.com/blog) to the root directory (www.yoursite.com)

  1. Open your .htaccess file (in the directory that houses your newly moved WordPress files) and edit in either your host’s file manager interface or by downloading to your local machine.
  2. Insert a line at the top that reads:
    redirect 301 /blog/ http://www.yoursite.com/
    Make sure to insert the opening and trailing / at the beginning and end of the originating path (e.g. /blog/) and to insert the trailing / at the end of the destination path (e.g. http://www.yoursite.com)
  3. Save your .htaccess file (and if you’re editing on your local machine rather than on the server, re-upload it).
  4. Load your old WordPress URL (e.g http://www.yoursite.com/blog) to make sure this worked.
  5. Enjoy the redirecting goodness.

I admit it’s a bit counterintuitive that the path you’re moving from needs to be input as just a path (e.g. /blog/ with no http://URL before it) while the path you’re moving to needs to be input as the full URL (e.g. http://www.yoursite.com). Maybe it’s just my server? But the Internet is a capricious and mysterious creature so I don’t ask, I simply do what works.

Thanks to the helpful article on 301 redirects at Taming the Beast for pointing me towards the right syntax.

posted under WordPress | 4 Comments »

Category feeds in WordPress

June11

TangognaT helpfully provides a surprisingly hard-to-find answer to a pretty basic question: how do you create category-specific RSS feeds in WordPress? And the answer is…

All you need to do is add a ?cat=# of category to the base url for any wordpress feed.

…so if you want to read everything I write about del.icio.us, but skip over all the yak yak yak about the future of democracy, you are a clearly shirking your civic duty and ignoring the broader current of public affairs in favour of your narrow obsession with blogging. However if you must persist in your wicked ways you would be able to read only my del.icio.us posts by subscribing to this feed:

http://www.alexandrasamuel.com/blog/wp-rss2.php?cat=22

(because del.icio.us is category #22 in my blog)

Cleverly enough, WordPress allows you to subscribe to feeds of multiple categories by separating the relevant category numbers with commas. So you could subscribe to:

http://www.alexandrasamuel.com/blog/wp-rss2.php?cat=22,32,48,50

To get everything I write about del.icio.us, tags, social bookmarking, or that was originally posted by me on You’re It.

I’ll be setting up an RSS subscription page soon with some options for different subscription sets from this blog.