Apache Redirects – For When Your Web Pages Move

apache-redirect-thumbnailRecently, I moved all of my Guild Wars content to a new website. I feel pretty good about the new content management system and the new direction of the website. But as I went to bed last night, I started thinking about 404 Errors – Page Not Found. I had forgotten to set up Apache Redirects. After having a dream about poor search engine ranking, I woke up and updated my .htaccess file. It was simple but important work. Without sending web traffic to the new location, I risked losing visitors. Fortunately, with Apache Redirects, I could point web visitors to the new locations. This should create a better experience for both Human and Robot visitors.

One simple line does the magic…

  • Redirect /category/guild-wars-fansite/ http://guildwars.us

There are three basic parts to an Apache redirect. The first part is the word “Redirect”. It says, “Hey… this is a redirect!” Wow, that’s so uncomplicated. All programming should be this easy. Put a space after the word “Redirect” and then put the old link, minus the domain name. Put another space and then put the new URL. That’s all there is to it.

By updating the .htaccess file on Photics.com, I could point certain traffic to the new Guild Wars fansite.

Search Engine Optimization is one of my favorite things about web development. By understanding a few basic ideas, you can bring a lot more traffic to your website. Or in this case, prevent losing it. Basically, it’s about speaking to robots, knowing what they want and how they go about doing it. Every day, Google sends their machines to download and analyze my website. But during the last week, these robots might have been confused. “Beep… beep… Mike… where is the content? This does not compute. Ranking lowered.” It’s not just the robots that were confused. If you clicked an old link, or perhaps an old bookmark, you would get an “Error 404 – Not Found” error.

The problem is that my site has been around for more than a decade. I’m still getting traffic from links that haven’t worked in years. I don’t want to go too crazy with Redirects, it might slow down my server. I felt that it was good enough to stop the main traffic leaks. One of the biggest sources of traffic to Photics.com is from the official Guild Wars website. I can’t update their community fansite roster page with the correct link. That’s ArenaNet job and they will probably update it eventually. But until then, I can use a redirect to send visitors to the appropriate content.

If you do not have an .htaccess file, or if you do not have permission to edit it, you can use a more crude manor of redirection… META Refresh.

  • <meta http-equiv=”refresh” content=”0;url=http://guildwars.us/”>

This should send users to the new page, if they have the Meta Refresh feature enabled in their browser. but if that option is too unprofessional for you, PHP could be used instead. I prefer Apache redirects. It’s simple and elegant. With FileZilla (my preferred FTP program) and Notepad++ I just download and edit the .htaccess file. Although, be careful. One misplaced character could mess up your entire site. I’ve done that few times before, but I simply corrected my typo or reverted to a previous copy of my .htaccess file.

Anyway, I’m thinking that the additions to my .htaccess file should result in fewer lost visitors. :-)