I've had a good old search around the web and I've come up more or less empty handed. I'm posting here in the hope that someone will help me out. I'm trying to redirect all people who don't aren't a certain an IP (mine) to a page called holder.html using a 302 (temp) redirect using .htaccess. I have found this snippet but it doesn't seem to be working for me (and it doesn't seem correct): Options +FollowSymlinks RewriteEngine on RewriteCond %{REMOTE_HOST} !^123\.45\.67\.89 RewriteCond %{REQUEST_URI} !/holder\.html$ RewriteRule \.html$ /holder.html [R=302,L] Any help appreciated, a salution even more so.
Have you tried using a full URL as the redirect destination? Either that or specify the RewriteBase. Also, that should only redirect .html pages - is that what you wanted?
I just did but it doesn't seem any different. The code I posted above doesn't seem to be denying any IPs. I suspect that it might all be wrong. Heh, nope. I want it to redirect everything. If you haven't noticed already I'm a .htaccess newbie but I'm trying to learn.
Ah yeh, the variable name is wrong. It should be REMOTE_ADDR, not REMOTE_HOST. Options +FollowSymlinks RewriteEngine on RewriteCond %{REMOTE_ADDR} !^123\.45\.67\.89$ RewriteCond %{REQUEST_URI} !/holder\.html$ RewriteRule .* http://www.domain.com/holder.html [R,L] Code (markup):