Help with SetEnvIf?

Something can not find in docks on the Apache how to make such feature: to set an environment variable if Remote_Addr and Server_Addr are the same.


The syntax is:
SetEnvIf <env_var> <regexp> <value1=1> <valuen=n>


Trying to do:
SetEnvIf Remote_Addr Server_Addr IN_DEV=1

Not working. Apparently you need to right substitute . Can anyone suggest how to resolve my issue?
October 8th 19 at 00:37
1 answer
October 8th 19 at 00:39
Solution
RewriteEngine on
RewriteCond %{SERVER_ADDR}_%{REMOTE_HOST} ^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)_\1$
RewriteRule .* - [E=IN_DEV:1]
even better
RewriteCond %{SERVER_ADDR}_%{REMOTE_HOST} ^([^_]+)_\1$
IPv6 will work - Violet_Wiso commented on October 8th 19 at 00:42
Thank you :) - vito.Hoeg commented on October 8th 19 at 00:45

Find more questions by tags htaccessApache