Redirect question, with a sweet twist.
March 3, 2009 10:13 PM   Subscribe

I'm moving Wordpress from to, but I'm also putting in something new at root that I want people to see. Please .htaccess my brains out.

I would like to move my Wordpress installation from to, so I can put a sweet Sweetcron installation at root. After I move Wordpress, I want to make sure that all my pages map to their new URLS. For example, needs to go to

But! Since I'll have a new page at root, I do not want to redirect to I want people who land at to stay right where they are. I've tried tutorials, video tutorials, and htaccess generators, but nothing seems to work. This question doesn't cover it either. I know there's a combination of rules out there for me. Thanks in advance.
posted by miniminimarket to Computers & Internet (9 answers total) 5 users marked this as a favorite
RewriteEngine on
RewriteRule ^200(.*)$ /blog/200$1 [r=301,nc]

to the rescue!
posted by soma lkzx at 10:18 PM on March 3, 2009

or RewriteRule ^20(.*)$ /blog/20$1 [r=301,nc] if you're still going to be blogging in the incredible future that is 2010.
posted by soma lkzx at 10:19 PM on March 3, 2009

Your redirects need to guess whether a given request is for wp or for something else, right? I'd use a RedirectMatch (or a mod_rewrite rule) and redirect all urls that look wordpress-y (say, which start with four digits— I'm not sure what other urls wp might want to serve up. You could grep your access logs to see, I guess.) You need to leave alone any urls that sweetcron should respond to, of course.
posted by hattifattener at 10:20 PM on March 3, 2009

Cool, soma lkzx -- so that would take care of all my 200- posts? I do have some pages on my Wordpress install, like but those aren't that important. I'm still not entirely sure about rewrite vs redirect, but I think rewrite is the better choice, Google/SEO-wise..? Thanks again.
posted by miniminimarket at 10:30 PM on March 3, 2009

For the rest you can do something like

Redirect 301 /about-me/

on a per-page basis. As for the difference, RewriteRules are dynamic and magic redirects, while 'Redirect' is just "here's one page, here's the new page". Don't worry, though, the r=301 in the RewriteRule is sending a 301 redirect to Google, so your SEO is just fine.
posted by soma lkzx at 10:35 PM on March 3, 2009

Rewrite will make the blog pages appear at the old URL (it's "rewriting" the incoming request before Apache decides how to deal with it); redirect will mean that browsers visiting the old URL will get redirected to the new URL.
posted by hattifattener at 11:29 PM on March 3, 2009

hattifattner: actually, no. the "r" in "[r=301,nc]" means "redirect". The 301 means "moved permanently" and the "nc" means "no case" ie. be case insensitive. The end result of soma's directive is a redirect.
posted by beerbajay at 3:12 AM on March 4, 2009

soma lkzx: This totally worked. For anyone else moving their Wordpress installation, don't forget that you might also have to move tags and categories over, but that's much simpler:

redirect 301 /tag

etc etc.

Now I just need to regenerate a new Google sitemap and change my Feedburner feed. Hopefully that handles everything I needed for the transition.
posted by miniminimarket at 8:35 AM on March 4, 2009

beerbajay: Ah, you're right, of course. I usually use mod_rewrite to rewrite without emitting a redirect.
posted by hattifattener at 11:15 PM on March 4, 2009

« Older Should I stay or should I go?   |   Give me the rundown on expensive cancer sticks. Newer »
This thread is closed to new comments.