301 old blog links

New to mod_rewrite? This is a good place to start.

301 old blog links

Postby BMN » Tue Jan 04, 2011 10:41 am

I have a bunch of old blog links in this form:
Code: Select all
http://www.sitename.com/999/blog-slug-name/
(was on the index.php file)

I have set up a new structure and this is where all of my posts are now:
Code: Select all
http://www.sitename.com/post/999/blog-slug-name/


I've tried looking for 301 rewrite code, but have came up short. I'm assuming this is an easy line of code, but I just can't figure out what it should be.

Thanks.
BMN
 
Posts: 39
Joined: Wed Jul 05, 2006 2:15 am

Re: 301 old blog links

Postby linux4me » Tue Jan 11, 2011 3:23 pm

I'm a noob at this, too, but I think what you're looking for is something along these lines:

RewriteRule ^/?999/([a-z/.]+)$ post/999/$1 [R=301,L]

which I adapted from example #6 at http://articles.sitepoint.com/article/a ... examples/2

I'm not sure the "L" flag should be in there. You may want to try leaving it out if it's not the last line in your .htaccess.
linux4me
 
Posts: 4
Joined: Sun May 18, 2008 10:52 am


Return to Beginner's Corner

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron