Thursday, January 24th, 2013
Last nite I was up super late moving my blog from /blog/wordpress/ to root/. It was quite the process, but I survived. One of my main worries is that Google has indexed all of my posts and some have been bookmarked by visitors. Instead of those users and Google indexed links being SOL, I needed a way to redirect all users using the old links to the new directory, the root/. Instead of doing a 301 Redirect on each post, I came up with the the following solution.
Add this snippet to your .htaccess file:
RewriteEngine On RewriteBase / RewriteRule ^blog/wordpress/(.*)$ /$1 [R=301,L]
At a high level, when a URL entering my blog contains /blog/wordpress/, it get’s redirected to root/. The $1 takes everything that was after /blog/wordpress/ and adds it to the end of the new URL (root/).
http://www.interactivebynature.net/blog/wordpress/2011.09.21.breaking-development-in-nashville now becomes http://www.interactivebynature.net/2011.09.21.breaking-development-in-nashville.
You can test it out here:
How do you handle directory redirects? Let me know in the comments!
Monday, January 7th, 2013
Straight from their meetup profile: