Skip to content

Instantly share code, notes, and snippets.

@kyleslattery
Forked from anonymous/301ingforfun
Created November 16, 2009 01:08
Show Gist options
  • Save kyleslattery/235623 to your computer and use it in GitHub Desktop.
Save kyleslattery/235623 to your computer and use it in GitHub Desktop.
# Pretty sure you can't do a range of numbers like ([01-31])
# Instead, you'll have to do ([0-3]?[0-9]):
# I also condensed the separate years into one rule
#RewriteEngine On
#RedirectMatch 301 /(2006|2007|2008|2009)/([0-1]?[0-9])/([0-3]?[0-9]))/(.*)$ http://old.bleikamp.com/$1/$2/$3/$4
#Ok, here's an updated one:
RewriteEngine On
RewriteRule ^(2006|2007|2008|2009)/([0-1]?[0-9])/([0-3]?[0-9])/(.*) http://old.bleikamp.com/$1/$2/$3/$4 [R=301]
# You'll also need rules for each of the different URL levels:
RewriteRule ^(2006|2007|2008|2009)/([0-1]?[0-9])/([0-3]?[0-9]) http://old.bleikamp.com/$1/$2/$3 [R=301]
RewriteRule ^(2006|2007|2008|2009)/([0-1]?[0-9]) http://old.bleikamp.com/$1/$2 [R=301]
RewriteRule ^(2006|2007|2008|2009) http://old.bleikamp.com/$1 [R=301]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment