WordPress.org

Support

Support » How-To and Troubleshooting » quick htaccess question

quick htaccess question

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

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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.

    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.

    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.

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘quick htaccess question’ is closed to new replies.
Skip to toolbar