It was lunch and was surfing about the blogosphere … when I clicked over to InstaPundit.Com. More specifically, I clicked on a link to his OLD domain. You see, he’s moving. And that’s okay … so long as you do it right.
What the InstaPundit does right is he uses a <meta http-equiv=”refresh” … > to get you to the new site, but there are some other ways of getting your user to your new domain via the server-side, which means it appears almost instant and automagic (in most cases).
So, here’s what I would do if I were the InstaPundit … and I were running my website on a linux/apache configuration … I’d create a file called “index.cgi” which would contain the following code:
$url = “http://18.104.22.168”;
print “Location: $url\n\n”;
Of course, if he were writing this program on his pc, he’d need to ftp it to his subdomain ASCII mode, then make sure to “chmod 755” the file for good measure.
I of course would just SSH over to my host, go to the subdirectory and use my PICO editor to create this little beauty on my side. I know, because I just did it last night when I moved everything from the /blog directory down to the root.
I’d also have to make sure there was no instance of files by the name of “index.html, index.shtml, index.htm, index.php” … as by default, they would execute first (as your webhost provider about this).
If I wanted to get fancy, I believe there is a way you can modify this script to determine what URL they actually entered, and subsequently how to redirect accordingly … but he’s going to have to mention me in a blog before I show that trick off!