Need help with site redirect to splash page, htaccess not doing the trick

Hi, i tried this:

RewriteEngine On
# Put your own IP in the next line, so you don't get the stopper, but
# everyone else does
RewriteCond %{REMOTE_ADDR} !^1\\.1\\.1\\.1$
RewriteCond %{REQUEST_URI} !^/stopper.html$
RewriteRule . /stopper.html [L]

And it worked for straight calls to my domain name, but if someone typed in a directory manually it let them right in instead of redirecting.

Any ideas how to 100% block all traffic to my site + redirect + let a couple specific ip’s through?





No, the OP’s mod_rewrite should not work if he’s using Apache 2.x. However, Apache 1.x would require, as you pointed out, a null path/filename to avoid the stopper script. I’d have pointed that out and started from scratch with some means to avoid the loop to stopper.html like …

Personally, I’d tie the stopper script to a cookie so that it’s only presented once (or once per year). mod_rewrite can (if memory serves) check a cookie before redirecting to stopper and stopper must be able to create a cookie to prevent seeing it again … and again …

Okay, I don’t use those horrible flash screens to welcome someone (unless a client demands it) as it’s an intrusion on a visit to my site. IF the client demands it, though, that’s their right and a cookie is the best way to ensure that the visitor is only annoyed once. :twocents:



NOT SO (if the / is removed as discussed above). However, the problem that the OP will have is not having visitors being looped to the stopper page for EVERY request (it WILL be a STOPper page!).

I was wondering if that’s what the OP meant people were doing now…

Hm, rewrite conds stack onto each other… they are and-ed.

So first the rule asks if it’s (not) your IP, and then it asks if the request (didn’t) end with “stopper.html”, and if those two things are true then rewrite to stopper.html

So I can just not type in stopper.html, right? I can get in by just typing or and get in?

So you’ll want to (temporarily) remove that line and get your IP-blocking part working first. (your rewrite rule prolly wants a .? instead of a . which matches just one character)

Once you’re sure you did that line right, you can prolly have your second line be more like, If the request uri ends with stopper.html, skip the next rewrite (using the skip flag). That ought to make sure those already going to stopper.html don’t bother with the rewrite.

You said “redirect” a few times in your post. You meant “rewrite” right? You’re not redirecting right now, but you might want to consider it (make it obvious to the visitor that they’ve been redirected). You can do this either by using the R flag in your rewrite rule, or an actual redirect as done with mod_alias. Which one might depend on whether this is a temporary thing or a permanent thing. Is this part of some sort of security?