问题描述
我使用“ wayback_machine_downloader”下载了一些网站。有些文件的名称类似super.html!q=4343
。但是IIS并未将其检测为HTML文件,Windows则检测到文件扩展名为.html!q=4343
。
我想要这样的事情:当人们访问http://www.example.com/super.html!q=4343
时,我希望将此文件显示为普通HTML。这在代码中只是纯HTML。
我知道要更改扩展名,但是其他HTML文件正在链接到此/super.html!q=4343
。
有些文件的编号和内容也不同。 (例如/super.html!q=6556
或/super.html!d=5545
)
我不擅长写英语问题,但这是我最好的。抱歉。
有没有办法解决?谢谢!
解决方法
通常,您需要在网站的web.config中添加一个mime映射。例如,要使URL http://www.example.com/super.html!q=4343
正常工作,您可以执行以下操作:
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".html!q=4343" mimeType="text/html" />
</staticContent>
</system.webServer>
</configuration>
以上内容仅适用于特定扩展名。要使用所有扩展程序,请使用以下代码段。这将适用于所有扩展。
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension="*" mimeType="text/html" />
</staticContent>
</system.webServer>
</configuration>