How I Redirect Web Traffic to a Server on a Dynamic IP Address

[I believe this document is finished, if you notice something missing, or if you have any problems, then contact me.]

This document will assume you understand the basics of DNS, the Apache web server, SSH and Unix. SSH is not required, but it is suggested. I will not attempt to teach you any of these. Also, this comes with the standard no-warranty, claim. If you blow-up your computer from following, these directions, I cannot be responsible, in any way, shape, or form.


How My Way© Compares to "Dynamic" DNS

Some Notes Before We Get Started

Configuring the Static Server

Configuring the Dynamic Server

How Everything Works

Going Online
  1. The dynamic server is connected to the internet with the /etc/ppp/ppp-on script
  2. After the ppp connection is established, the /etc/ppp/ip-up.local script is run
  3. The ip-up.local script connects to the static server with ssh, and runs "redirect" (on the static server) with our dynamic IP address as its argument.
  4. On the static server, the "redirect" script creates the .htaccess file in the proper directory, which looks something like:
    Redirect /
What happens when a request comes in
  1. The .htaccess file has the magic Redirect directive, that generates a code 302, which is a redirect, to your dynamic IP address. The index.html is ignored, because of the Redirect directive. Everything is redirected to your dynamic server, so "" is redirected to "".
  2. When the web browser get the code 302, it redirects to your dynamic web server. The code 302 is embedded with your dynamic IP address
Going Offline
  1. The script /etc/ppp/ppp-off is executed on the dynamic server, starting the disconnection procedure.
  2. Before you're disconnected, ppp-off uses ssh to delete the /home/joe/www/.htaccess file on the static server.
What Happens When a Request Comes In After Your Dynamic Server is Offline
  1. if some one tries to connect to "" you'll get the default page on the static server, saying you're not online.
  2. if someone tries to connect to "" they'll get the code (error) 404 document, which is the index.html page on the static server saying you're not online.

TroubleShooting Help and Some Tips