.htaccess code for chosen ip redirection from requested page

I’ve been working on this for a couple of days. I’ve been to several sites offering this, but nothing I’ve tried seems to work.

I have a visitor to my site and I know their IP address, (I understand that can change overtime and this is temporary). When they request a certain page on my site I want to redirect them to another page. I’m trying to do this via .htaccess

Read More

This is what I’ve done, recommended by a site, but it doesn’t work:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

RewriteEngine On
RewriteCond %{REMOTE_ADDR} ^69.82.85.525$
RewriteRule ^page-to-be-redirected-from /page-to-be-redirected-to [R,NC,L]

I don’t know how much the WordPress code is affecting the code I am trying to add. For instance, I know it creates pretty urls and I am assuming that the urls I am adding would be recognized for what they are. I have tried to attach the domain name to the urls, but it hasn’t made any difference. This code is not working.

Here is another effort:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} 69.82.85.525
RewriteCond %{REQUEST_URI} /requested-page$
RewriteRule .* /redirected-page [R=301,L]

Having spent so much time searching for a solution to this, I know that there are other people puzzled by how to accomplish this. But, even .htaccess redirects that have been discussed here on StackOverflow have not addressed this particular situation.

Thanks.

Related posts