Html 如何使用web配置删除X-Powered-By标头

Html 如何使用web配置删除X-Powered-By标头,html,iis,http-headers,web-config,Html,Iis,Http Headers,Web Config,您好,我正在尝试使用我的web.config删除X-Powered-By标题。 这是到目前为止我的web.config文件 <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.webServer> <rewrite> <rules> <rule name="Rule" stop

您好,我正在尝试使用我的web.config删除X-Powered-By标题。 这是到目前为止我的web.config文件

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Rule" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                        <conditions>
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                            <add input="{URL}" pattern="^/favicon.ico$" ignoreCase="false" negate="true" />
                        </conditions>
                        <action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>
<httpProtocol>
   <customHeaders>
    <clear />
       <remove name="X-Powered-By" />
   </customHeaders>
</httpProtocol>
    </system.webServer>
</configuration>


但一旦我检查,它仍然显示x-powered-by…

请尝试将其放在
index.php
文件的顶部:

header_remove("X-Powered-By");

尝试将其放在
index.php文件的顶部:

header_remove("X-Powered-By");


有关不同选项,请参见此处:


有关不同选项,请参见此处: