Is there a way to conditionally execute php_flag statements in .htaccess? Here are two things I'm trying to do:
Turn error reporting on if the client's IP address matches the IP address I use:
if %{REMOTE_ADDR} == '12.34.56.78' then
php_flag error_reporting 1
else
php_flag error_reporting 0
Turn off register_globals
if the IP address matches mine, so that I can debug any issues caused by the code expecting this turned on.
if %{REMOTE_ADDR} == '12.34.56.78' then
php_flag register_globals on
else
php_flag register_globals on
Thanks for reading!
kerry,
I suspect that the problem with your first attempt is that your regular expression is "^192\.168\.0$
". This will never match any possible Remote_Addr since you've only got 3 parts to the IP address, with a forced "^
" start and "$
" end.
Perhaps you intended to use the regular expression "^192\.168\.0\.
" ?
Note that I've excluded the "$
" at the end, so that it doesn't matter how the IP address ends. And that I've included an extra "\.
" escaped period so that you'll force the matching IP addresses to have an actual "0
" and not something like "012
", "001
", etc (not that these zero-filled parts should be present in any IP address).