Now that the new blog is in place, it needs people to be able to find it. I looked in the logs and nobody is getting to it via search engines. Jeb was going to set up some redirects at some point to automatically forward people from the old pages to the new ones. Sometimes you will run across a web page that tells you the original page has moved and will transfer you to the new page in a couple of seconds. You can do this with meta tags or with some javascript. But the best way to do this is through a 301 redirect which users won’t even notice and Google and other search engines accept as an official move of your site. The “301” number means the page has moved permanently. If Google was sending people to your old page, when they see the 301 redirect they should keep sending them to the new site. With websites, it is all about keeping your page rank with Google. For instance, on the Flashlight Wiki this month, 3,553 visitors were referred by search engines. 3,296 of those were referred by Google (93%). Second place is Yahoo with 93 referrals (2.6%). Not that the blog is a money making site, but it’s nice to be noticed.
The best way to redirect people is through the internet server using Apache, but that isn’t available unless you have your own server. The next best way is through a .htaccess file, which gives the server instructions on how to handle files. And it is pretty easy to just put a line in this text file saying to redirect anyone who asks for a particular web page to go to the new page. The problem is I have 633 web pages (each blog post).
Actually this isn’t that bad. I have archive pages on both sites that list all the entries and have links. So it isn’t that hard to take the source of those two pages, get rid of the stuff I don’t want, combine the files, and then add the redirect command to each line. Now I have my 633 redirects.
redirect 301 /archives/2011/mcafee.html http://fiveforks.com/ted/2011/12/mcafee/
This is the brute force method. There are more elegant solutions. You can make one statement with wildcards and say anyone who wants a page on the old website can find exactly the same file on the new site. This works well as long as the file names and the paths to the directory are the same at both sites. But that would be too easy. I have my old blog structure set up with all the entries in an archive folder, then subdirectories for the year. However WordPress skips an archive folder and adds an extra subdirectory for the month. Further, the old site has pages ending in .html but the new site just ends in a slash after the post name. I could deal with the archive and the slash with some clever wildcards, but there is no way to get the month. Some people were even able to come up with a way to forward the name of posts with underscores separating the words on their old blog to the dashes between words that WordPress favors (supposedly because Google can separate words with dashes but not words with underscores, and if Google can read the words then it can send people looking for those words to your page).
Jeb’s blog uses a month directory in the path, so he will probably be able to use a blanket statement with wild cards, but meanwhile I could not get even a simple redirect to work. I tried putting a .htaccess file in my archives folder, in the year folder, in the five forks root, and still got nothing.
I went looking for other solutions and found a Movable Type template that would produce a 301 redirect using php. The problem with that is the posts are all html, not php. It is possible to modify htaccess to tell the server to process html files as php files, and I tried that a lot of different ways, but I couldn’t make that work.
So finally I went back and thought about the brute force method some more, and figured the htaccess file should really be on the root of mac.fiveforks.com and not just fiveforks.com. I looked up the properties for the mac5 subdomain to get the correct directory and found a blank htaccess file there. I put one redirect in there as a test and it worked fine. So the answer was in front of me all along, I was just in the wrong place. I put my big text file of redirects and, after some tweaks, got it working just fine for every entry.
It could be that I could get the html/php thing to work by modifying the correct htaccess file (now that I know where it is), but I don’t know if there is a point now that I have what I want. There could be some slowdown on the server as it reads through the 633-line htaccess file every time someone gets a file from Mac5, but the redirects aren’t forever, just until Google figures it all out.
It’s already working. According to the web server statistics for fiveforks.com last night people searched for (and found) pages about: fixing zippers, Michael Lewis articles, and Versapak tools.
Google has started picking up the new blog and the page rank seems to have transferred. I looked up some zipper search phrases and am still ranked pretty high with the new site. However I also looked up a pine cone article and it still links to the old site.