Let’s say you’ve decided to finally update your website that has been sitting untouched gathering “spider” “webs”… get it… spider? webs? Oh, forget it… you people have no sense of humor anymore… you wouldn’t laugh even if we tcl/tk’ed you!? Get it, get it… TCL!! OK, OK… I’m finished for real this time. :-)

So let’s say that you really do want to finally work on your website, but you decide to be the sloppy coder that we all can be at times and you just want to code straight from the source code in your live/production environment. And, of course, you are perfect and will make absolutely no mistakes between saving your changes line by line, so your visitors will be completely unaware that any changes are even being made. Ok… now THAT was funny. We all make mistakes and the last thing you want to do (or at least the last thing “I” want you to do) is gift more damn errors to the “InterWeb”, so for the sake of a good example, let’s create a “Under Construction” page the we will have your visitors redirected to while you are working on your masterpiece.

Create the file hangOnASec.html with something simple… just a little image or message letting your visitors know that you are currently working on your website and to check back soon. You could even ask them to leave their email address, so that once you’re finished, you can send out a mass email letting everything know that you are indeed finished. See File 1.0 for your first addition for this tutorial.

File 1.0 – hangOnASec.html

“Thank you for visiting EzMoFo.info. Being the kick ass person that I am have decided to update my website for you. Anywhoozle, I’ll be finished soon, but while I’m working on the updates I just thought I would forward you to this message so you wouldn’t be plagued with nasty error messages that we all HATE! This message will go away once I’m finished with the updates. Check back later to see that new site!”

Next, you’ll just need to go to your typical default page to add a simple line of code that will redirect your visitors to the message that you have left for them at “hangOnASec.html”. You don’t need to comment out any code or delete anything… just place these few lines at the main top of the page and you can leave everything else alone if you want.

First let’s look at how to do this in PHP… it is SUPER easy and you’ll find many different scenarios when this will come in handy for you. I’m glad I’m able to share and hopefully can help something who’s trying to learn them some PHP!  It’s as easy as Paris Hilton was in “A Night In Paris”, all you gotta’ do is add the following little blurb of code:

<?php
header(“Location: http://www.ezMofo.info/hangOnASec.html”);
?>

So, so easy, right? It simply relocates the browser to the new page, which in this example is “http://www.ezMofo.info/hangOnASec.thml”.

Want to do the exact same thing in ColdFusion? Again… easier than Paris! See below:

<cflocation url=”hangOnASec.html” addtoken=”no”>

Let us know if you have any problems or comments… or if you have any other ideas or suggestions for more efficient ways to do the same thing. Have other languages that you want to share tricks with us? We would, of course, love to hear from you and see your code examples. Leave us a comment!