开发者

htaccess turn on php flags if certain IP address

开发者 https://www.devze.com 2023-01-03 10:46 出处:网络
In my .htaccess file I need to turn开发者_JAVA百科 on the following: php_flag display_errors On php_value error_reporting 2147483647

In my .htaccess file I need to turn开发者_JAVA百科 on the following:

php_flag display_errors On
php_value error_reporting 2147483647

However I only want to do this if my IP is visiting the site.

Any ideas?

Something like...

if (ip == "x.x.x.x") {
  php_flag display_errors On
  php_value error_reporting 2147483647
}

Need to do this in .htaccess NOT in the PHP thanks!


You can actually do this in Apache 2.4 using an If directive. I'm not sure all php_flag commands work this way but some do.

For example,

<If "%{REMOTE_ADDR} = 'XXX.XXX.XXX.XXX'">
    php_flag xdebug.remote_autostart On
    php_flag xdebug.remote_enable On
</If>


There is no easy way to do this in the httpd configuration. Consider using a script in auto_prepend_file instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号