WordPress.org

Ready to get started?Download WordPress

Forums

quick htaccess question (5 posts)

  1. elmsblog
    Member
    Posted 8 years ago #

    Is it possible to redirect just 1 ip address by using .htaccess? I've been Googling for hours now.

    Thanks.

  2. jaredquinn
    Member
    Posted 8 years ago #

    Can you provide more info as to what you want to achieve?

    "IP address" redirection is something altogether different then .htaccess - .htaccess can redirect URLs.

  3. elmsblog
    Member
    Posted 8 years ago #

    yeah, sorry. guess it just shows my noobieness. :) if the ip address: xxx.xxx.xxx.xxx visits my site, I'd like it to redirect them to a specific page. Is that more of a PHP thing maybe?

    I appreciate the help.

  4. jaredquinn
    Member
    Posted 8 years ago #

    Even more interesting, redirect based on <i>source</i> IP address.

    The quickest dirtyest hack that comes to mind right this instant is to use PHP to do it; in index.php something like:


    if($_SERVER['REMOTE_ADDR'] == 'a.b.c.d') header('Location: http://new-location/page');

    On digging a little deeper, you can do it in your .htaccess file with a Rewrite... check http://httpd.apache.org/docs/1.3/misc/rewriteguide.html (for Apache 1.3, or the one for your relevant version) for the Guide to Rewrite.

  5. elmsblog
    Member
    Posted 8 years ago #

    is there any way then to know when or how often this guy gets redirected?

Topic Closed

This topic has been closed to new replies.

About this Topic