Support » Plugins » Using .htaccess to redirect only 1 IP

  • Well, I have 1 known visitor who uses the same ip address EVERY time. I have been googling for 2+ hours now, and just want to know if I can redirect this 1 ip address to a special page or alternate site altogether.

    I’ve been messing with Rewrite rules in my .htaccess file all day now it seems, but nothing works (testing on my own ip).

    The next question is then can I log how often it redirects this guy?

    Thanks guys!

    P h i l

Viewing 3 replies - 1 through 3 (of 3 total)
  • I don’t know about the logging but

    order allow,deny
    allow from all
    deny from xx.xx.xx.xx

    will bar one IP address from your server

    How about doing it with PHP? (I’m assuming you want to do more than just ban the user)

    if ('123.456.789.012' == $_SERVER['REMOTE_ADDR']) {
    echo 'hi Bob!';
    . . .

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    RewriteCond %{REMOTE_ADDR}
    RewriteRule !^redir.php$ /redir.php [R,L]

    Where /redir.php is the file you want to be directed to.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Using .htaccess to redirect only 1 IP’ is closed to new replies.