1分鐘隱藏Apache、PHP、WordPress版本號數

腫魔沒人留言?快點下去搶頭香啊!

檔案路徑和設定語法

  1. Apache: …\apache2\conf\httpd.conf
    ServerSignature Off
    ServerTokens Prod
    TraceEnable Off

    參考Apache > HTTP Server > Documentation > Version 2.4 > Modules:

    1. ServerSignature
    2. ServerTokens
    3. TraceEnable
  2. PHP: …\php\php.ini
    expose_php=Off

    參考PHP.net

  3. WordPress: …\wordpress\wp-content\themes\[佈景主題名稱]\functions.php
    // remove version from head
    remove_action('wp_head', 'wp_generator');
    // remove version from rss
    add_filter('the_generator', '__return_empty_string');
    // remove version from scripts and styles
    function shapeSpace_remove_version_scripts_styles($src) {
    	if (strpos($src, 'ver=')) {
    		$src = remove_query_arg('ver', $src);
    	}
    	return $src;
    }
    add_filter('style_loader_src', 'shapeSpace_remove_version_scripts_styles', 9999);
    add_filter('script_loader_src', 'shapeSpace_remove_version_scripts_styles', 9999);

    參考digwp.com: How to Remove the WordPress Version Number

0 0 vote
Article Rating
訂閱(Subscribe)
來自於(Notify of)
0 Comments
Inline Feedbacks
View all comments