.htaccess Restrict by IP

I’m trying to figure out how to restrict my home page so that only my IP address can access index.php. I don’t want to completely shut down my site to other tho. Here’s what I have in mind.

If the IP address is mine, go to index.php
All others are redirected to index.html

Nate,

What you’re trying to do MUST (if mod_rewrite is used) is to use Apache’s {REMOTE_ADDR} variable, i.e., the IP address of the visitor. To do this:

  1. Make your DirectoryIndex index.html index.php

  2. Test whether the {REMOTE_ADDR} is your IP address

  3. Redirect (if your IP) to index.php

Show me your code and I’ll help clean it up - examples in my signature’s mod_rewrite tutorial.

Regards,

DK