Removing X-Powered-By

后端 未结 8 2295
温柔的废话
温柔的废话 2020-12-02 05:11
  1. How can I remove X-Powered-By header in PHP? I am on an Apache Server and I use php 5.21. I can\'t use the header_remove function in php as it\'s not supported by 5

相关标签:
8条回答
  • 2020-12-02 05:51

    If you use FastCGI try:

    fastcgi_hide_header X-Powered-By;
    
    0 讨论(0)
  • 2020-12-02 05:54

    If you cannot disable the expose_php directive to mute PHP’s talkativeness (requires access to the php.ini), you could use Apache’s Header directive to remove the header field:

    Header unset X-Powered-By
    
    0 讨论(0)
  • 2020-12-02 05:58
    if (function_exists('header_remove')) {
        header_remove('X-Powered-By'); // PHP 5.3+
    } else {
        @ini_set('expose_php', 'off');
    }
    
    0 讨论(0)
  • 2020-12-02 05:59

    Try adding a header() call before sending headers, like:

    header('X-Powered-By: Our company\'s development team');
    

    regardless of the expose_php setting in php.ini

    0 讨论(0)
  • 2020-12-02 06:06
    header_remove("X-Powered-By");
    

    https://secure.php.net/manual/en/function.header-remove.php

    0 讨论(0)
  • 2020-12-02 06:10

    If you have an access to php.ini, set expose_php = Off.

    0 讨论(0)
提交回复
热议问题