File extension of zlib zipped html page?

假装没事ソ 提交于 2020-01-04 06:49:36

问题


What does a zipped html file using zlib (deflate) look like sitting on the server? Does it have a different extension than .html?


回答1:


Depending on your webserver settings, it is also possible to zip the html files in advance, in addition to having the webserver automatically zip them. Usually the extension is .gz, eg MyPage.html becomes MyPage.html.gz. With the right settings, if someone requests http://example.com/MyPage.html, and Apache sees MyPage.html.gz, and the client supports compression, it will instead serve the MyPage.html.gz version. The client will then transparently decompress the content, and the user will not even know or care that it was compressed (except maybe being slightly happier that the page loaded a fraction of a second faster)




回答2:


It has the extension you uploaded it with.

Note that if you ask the web server to serve deflated html pages, it will do so on-the-fly, and any caching it does will be somewhere other than your web site directory, so you won't actually see those files, if they are files at all.

In other words, if you're serving on-the-fly compressed files, you store the normal files on the server with the normal .htm or .html extensions.



来源:https://stackoverflow.com/questions/858830/file-extension-of-zlib-zipped-html-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!