M
M
Mikhail Osher2012-04-09 11:58:36
Apache HTTP Server
Mikhail Osher, 2012-04-09 11:58:36

Help with SetEnvIf?

I can’t find something in the Apache docs, how to make such a feature: set an environment variable if Remote_Addr and Server_Addr match .
The syntax is:

SetEnvIf <env_var> <regexp> <value1=1> <valuen=n>

Trying:
SetEnvIf Remote_Addr Server_Addr IN_DEV=1
Doesn't work. Apparently, you need to correctly substitute <regexp>. Can anyone suggest how to solve my issue?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Burov, 2012-04-10
@miraage

RewriteEngine on
RewriteCond %{SERVER_ADDR}_%{REMOTE_HOST} ^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)_\1$
RewriteRule .*          -       [E=IN_DEV:1]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question