Apache rewrite condition not matching, possibly bad syntax?

my flag

Hi so I have a rewrite rule in order to control access to the admin page of a service behind a reverse proxy. I only want local ip's to be able to access it. So essentially if the condition does NOT match then we follow the rule and restrict access. However it seems the rewrite condition either never gets evaluated or doesn't match and I'm not sure which it is or how to check.

At the moment I have

RewriteCond %{REMOTE_ADD} !^192\.168\.1
RewriteRule /admin(.*) - [F,L]

but I have also tried

RewriteCond %{REMOTE_ADD} !"^192\.168\.1"
RewriteCond "%{REMOTE_ADD}" !"^192\.168\.1"
RewriteCond "%{REMOTE_ADD}" !"192\.168\.1"

amongst others that I have forgotten about. Any help in getting this to work correctly would be greatly appreciated.

digijay avatar
mx flag
Try it with `%{REMOTE_ADDR}`

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.