开发者

htaccess turn on php flags if certain IP address

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜