Great Anime Videos from Mu Monkey Anime Video Site, Great Anime Videos from Mu Monkey Anime Video Site, Doujin Work Anime Videos, Doujin Work Anime Videos, Gungrave Anime Videos, Gungrave Anime Videos, Cosprayers Anime Videos, Cosprayers Anime Videos, Big Windup Anime Videos, Big Windup Anime Videos, Zoids: Genesis Anime Videos, Zoids: Genesis Anime Videos, Sub Anime List Anime Videos, Sub Anime List Anime Videos, Blood+ Anime Videos, Blood+ Anime Videos, CardCaptor Sakura Anime Videos, CardCaptor Sakura Anime Videos, Episode 8 sub Anime Video by Miracle Train, Episode 8 sub Anime Video by Miracle Train, CardCaptor Sakura: Season 3 Anime Videos, CardCaptor Sakura: Season 3 Anime Videos, CardCaptor Sakura: Season 2 Anime Videos, CardCaptor Sakura: Season 2 Anime Videos, Ren and Stimpy Anime Videos, Ren and Stimpy Anime Videos, Ger Anime Movies Anime Videos, Ger Anime Movies Anime Videos, Genshiken 2 Anime Videos, Genshiken 2 Anime Videos, To Heart 2 Anime Videos, To Heart 2 Anime Videos, Megaman Anime Videos, Megaman Anime Videos, Futakoi Anime Videos, Futakoi Anime Videos, To Heart Anime Videos, To Heart Anime Videos, Anyamaru Tantei Kiruminzuu Anime Videos, Anyamaru Tantei Kiruminzuu Anime Videos, Kiddy Grade Anime Videos, Kiddy Grade Anime Videos, Shugo Chara Anime Videos, Shugo Chara Anime Videos, Arcade Gamer Fubuki Anime Videos, Arcade Gamer Fubuki Anime Videos, Arc The Lad Anime Videos, Arc The Lad Anime Videos, Bus Gamer Anime Videos, Bus Gamer Anime Videos, Tales Of Symphonia Anime Videos, Tales Of Symphonia Anime Videos, Bakugan Anime Videos, Bakugan Anime Videos, Angel Sanctuary Anime Videos, Angel Sanctuary Anime Videos, Weiss Kreuz Anime Videos, Weiss Kreuz Anime Videos, Great Anime Videos from Mu Monkey Anime Video Site, Great Anime Videos from Mu Monkey Anime Video Site, anime, anime, anime porn, anime porn, anime sex, anime sex, anime girls, anime girls, anime babe, anime babe, anime babes, anime babes, anime hentai, anime hentai, free anime porn, free anime porn, sexy anime, sexy anime, gay anime, gay anime, anime girl, anime girl, titanime, titanime, lesbian anime, lesbian anime, anime lesbians, anime lesbians, anime xxx, anime xxx, nude anime, nude anime, adult anime, adult anime, anime pussy, anime pussy, hentai anime, hentai anime, anime wallpaper, anime wallpaper, hot anime girls, hot anime girls, hot anime, hot anime, anime bondage, anime bondage, anime boobs, anime boobs, anime lesbian, anime lesbian, naked anime, naked anime, anime angels, anime angels, free anime sex, free anime sex, japanese anime porn, japanese anime porn, anime chicks, anime chicks, japanese anime, japanese anime, hardcore anime, hardcore anime, anime rape, anime rape, shemale anime, shemale anime, free anime, free anime, anime pics, anime pics, anime wallpapers, anime wallpapers, anime art, anime art, anime nude, anime nude, anime pictures, anime pictures, anime angel, anime angel, anime women, anime women, anime guys, anime guys, anime hardcore, anime hardcore, how to draw anime, how to draw anime, anime tits, anime tits, sexy anime girls, sexy anime girls, xxx anime, xxx anime, anime fucking, anime fucking, bleach anime, bleach anime, anime mp3, anime mp3, erotic anime, erotic anime, bible black anime, bible black anime, anime fuck, anime fuck, anime dickgirls, anime dickgirls, lesbian anime girls, lesbian anime girls, anime porno, anime porno, anime manga, anime manga, anime sex movies, anime sex movies, anime sexy, anime sexy, cute anime, cute anime, animes, animes, anime music, anime music, anime music videos, anime music videos, dark anime, dark anime, sex anime, sex anime, anime games, anime games, cute anime girls, cute anime girls, dbz anime porn, dbz anime porn,

uwMike.com

I am engaged to the beautiful and wonderful Tara Cleaver!

Proper Forwarding

October 5th, 2005 0

Since I’ve been through a handful of site migration situations, I thought I’d share a few tricks for seamless forwarding.

The Nuclear Option: .htaccess

A file names .htaccess can be placed in any location and provides the fastest and easiest option for a redirect:

Redirect permanent / http://newsite.com/

What does it do? It sends every path that comes to this site over to the new site, preserving the URL completely. So if a visitor hits http://oldsite.com/foo/bar, they’ll redirect to http://newsite.com/foo/bar.

Sometimes you’ll have a situation where parts of a link change, and parts stay the same. For example, in a recent move, I switched a Mediawiki installation from using the default URLs to using pretty URLs. The upgrade rule was like this:

Redirect permanent /wiki/index.php/ http://example.com/wiki/

So then the old links, like

http://example.com/wiki/index.php/Main_Page

Were forwarded automatically to

http://example.com/wiki/Main_Page

Redirects of this kind are extremely powerful, but also very broad. There’s little opportunity to fine-tune the redirect, it’s simply all or nothing.

To make a conditional redirect, or a redirect with some processing, we’ll need a little PHP.

Header Redirects

Consider a situation, similar to the wiki example above, where we’re moving from one URL style to another:

http://oldsite.com/index.php?article=34253

To

http://newsite.com/articles/my-article

It’s clear that the second is vastly superior, both for human use and search-engine readability. But would an htaccess rule know how to redirect this?

What needs to happen is an edit on the old site’s index.php:

<?php
    $slug = look_up_slug($_GET['article']);
    header('HTTP/1.1 301 Moved Permanently'); 
    header('Location: http://newsite.com/articles/'.$slug);
    exit;
?>

Before anything else goes to the browser, there’s an opportunity to send some headers. These can set cookies, for example, or tell the browser some information about the content being sent.

One of the possible headers is Location, which simply means “go here instead.”

So why do we have the exit on there? That’s to stop PHP executing once the redirect is sent. Otherwise PHP doesn’t know any better and would happily start spewing output to the browser, potentially causing all manner of confusion.

PHP Redirects

The first solution allowed sweeping redirects. The second one allowed specific redirects, but only from a single file.

What’s really needed is a union of these two approaches. What we’ll do is set up a special rule in .htaccess, which funnels all incoming requests into a single file. It’s really simple:

RewriteEngine On
RewriteRule ^(.*)$ redirect.php?request=$1

And then inside of the redirect.php script, you have all of PHP’s powerful string processing functions (and DB access) from which you can dissect the old URL and assemble a proper redirect out of it.

This is my favourite solution. And let me give you an example of its power.

Cleaning Up For Others

The website I created for my engineering class has lived at three different places over the course of its lifetime:

Check it out, all three of them forward to the present location.

But, there was a brief period where there was just the forum, and no homepage. During this period, the inbound link on the page here was created. It’s a link to an out-dated, arbitrary forum topic. And yet, that’s an important and relevant page at the University, and the logs indicated that people were following that link to our site.

Rather than hassle the webmaster to correct the error, I instead put a special rule in the redirect script. It detects that exact inbound link, and rather than forwarding to the forum, it forwards to the home page.

Classy, eh?

“We’ve Moved”

The one other thing I should mention is Moved pages.

Moved pages are a waste of a mouse-click. 99% of visitors don’t care if you’ve moved. They’ll update their bookmarks at their leisure, and if they don’t, it shouldn’t matter– your redirect scheme should forward them to the relevant content anyways.

But there’s a further reason to not use a Moved page: Google doesn’t know what it means. When you perform a proper redirect, that tells spiders and search engines that the content has moved permanently, which means they’ll update their caches accordingly. (And, I understand, pass on PageRank…)

The reason given for using a Moved page is that it’s to warn users about the redirect, rather than just lurching them to the new location. This, however, is silly, since it’s easy to just let them know, once on the target page.

When redirecting, it’s important to end up at an easy, “bookmarkable” URL. So sending the user to http://newsite.com/?new is probably not ideal. However, for the more ambitious, you can clear the ?new out of there. Simply set a cookie and then redirect again. When the cookie is detected, display the extra welcome notice… and clear the cookie.

Moving at all is non-ideal. But moves happen, and it’s best when it can be as streamlined as possible for the users.

Mike

Leave a Reply

You can use Markdown for style. I love hearing from readers, but please don’t hijack the discussion, use offensive language, or try to sell anything.

© 2004-2010, Mike Purvis, some rights reserved. I'm running Wordpress, and I have an RSS feed.