Hey everyone,

On my various website's I've tried to use the .htaccess file and one of the things I can't find how to do is redirecting everyone except me to a certain page.

Basically my IP would see whatever page but anyone else who goes to the directory would be sent to another page.

Thanks for the help.
Clarkie

    Well, this is a PHP forum, so, to do it with PHP:

    $myip="1.2.3.4";
    
    if ($_SERVER['REMOTE_HOST']!="$myip") {
       header("location:myredirect.php");
    }

    But .htaccess is probably a nice idea also (for example, you wouldn't have to add the above to every page (although if you use a common included header, no big deal 😉 )

    At any rate, try http://www.webmasterworld.com/forum92/167.htm for info on using .htaccess.

    HTH,

      Thanks that should work. It's a forum so I'll add it to the template.

        Write a Reply...