Moving A Website To Drupal... 301 Redirects and 404 Pages.
As some of you may have noticed, this site was moved this week from the old static pages, to a free content management system known as Drupal. Now, of course I didn't want to lose the many backlinks I have coming to my old site - and the search engine listings I have from BestJudo are tremendous - but would all be going to the wrong location after I moved. For example, the old location of my article on Shiro Saigo was www.bestjudo.com/article15.shtml - and if you type that old URL into your browser address tab - it will take you to the new location, which is: www.BestJudo.com/article/1233/shiro-saigo-judos-secret-weapon. You'll note that the name is a tad more descriptive of what the article is about.
How did I do this 'magic trick' of changing addresses 'on the fly'? It's a simple .htaccess trick called a 301 redirect. But the ordinary redirect doesn't work under Drupal, as I found out... you have to change it.
The ordinary form looks like this:
Redirect 301 oldfilename.html http://www.yourwebsite.com/newfilename.html
This will not work under Drupal... The form that you must use in your .htaccess file is this one:
RewriteRule article15.shtml /article/1233/shiro-saigo-judos-secret-weapon [R=301,L]
(Note that I gave you the exact one right out of my .htaccess file that redirects the Shiro Saigo article...)
Now, this is all well and good for ordinary webpages... such as all my Judo Book Reviews... but I also had a Wordpress blog on my old site - and I really didn't want to add redirects for all those blog posts (there's quite a few of them, sometimes as many as 15 in a month, and I had a few years of blog posts!), but I figured that the blog posts probably aren't as heavily searched for, and I could safely skip doing this work...
I was wrong! I started keeping a close watch on my log files when I switched the website over, and the first thing I noticed was a great deal of traffic coming from a Wikipedia link to a blog post I made on Kuzushi. Well, I really didn't want to lose that traffic - so I quickly put in a redirect for that particular blog post... but then I kept seeing 404 'Page Not Found' errors for all sorts of webpage blog posts... I really didn't realize that my blog was so heavily linked in the search engines, and I certainly don't want to lose any traffic!
So I went looking for a solution, and I found it. Drupal has a module called the Search 404 module, which changes a '404 Page Not Found' result into a search. So if you end up coming to one of my blog posts via a link to the old site, chances are fairly good that it will link directly to the new blog post, or at least present you with a list of possible posts on my new BestJudo site that match what you were looking for.
It's because of the raw power to do things like this that I wanted to move away from the static webpage design of the old site (and having been around since 2001 - in Internet terms, it's antique!) and move into the power of modern CMS's. Drupal is just one of many great CMS 'skeletons' that you can use to form a website around... Wordpress and Joomla are two of the more popular ones, but there are hundreds of them. So if you want to put up a website, check out any popular CMS, you don't have to learn HTML and code it from scratch, like I originally did!
And if you want to move your site to Drupal, just be ready to put in a few redirects, and the Search 404 module, and you'll keep the traffic you've built up!