我应该将 .htm 放在我的网址末尾吗? [英] Should I put .htm at the end of my urls?

查看:35
本文介绍了我应该将 .htm 放在我的网址末尾吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读的教程说要这样做,但我使用的网站都没有这样做.为什么不呢?

The tutorials I'm reading say to do that, but none of the websites I use do it. Why not?

推荐答案

我使用的网站都没有 [将 .htm 放入网址] 为什么不呢?

none of the websites I use [put .htm into urls] Why not?

简单的答案是:

大多数网站提供动态内容而不是静态 html 页面.

Most sites offer dynamic content instead of static html pages.

更长的答案:

文件扩展名无关紧要.一切都与网络服务器配置有关.

The file extension doesn't matter. It's all about the web server configuration.

Web 服务器检查文件的扩展名,然后它知道如何处理它(将 .html 直接发送到客户端,通过 mod_php 运行 .php 并生成一个 html 页面等)这是可配置的.

Web server checks the extension of the file, then it knows how to handle it (send .html straight to client, run .php through mod_php and generate a html page etc.) This is configurable.

然后 Web 服务器将内容(静态或生成的)发送给客户端,http 协议包括在发送网页之前告诉客户端标题中的内容类型.

Then web server sends the content (static or generated) to the client, and the http protocol includes telling the client the type of the content in the headers before the web page is sent.

顺便说一下,.htm 不再需要了.我们不再使用带有 8.3 文件名的 DOS.

By the way, .htm is no longer needed. We don't use DOS with 8.3 filenames anymore.

让它变得更复杂: :-)

Web 服务器可以进行 url 重写.例如,它可以将以下形式的所有 url 重定向:www.foo.com/photos/[imagename] 到位于 www.foo.com/imgview.php?image=[imagename]

Web server can do url rewriting. For example it could redirect all urls of form : www.foo.com/photos/[imagename] to actual script located in www.foo.com/imgview.php?image=[imagename]

这篇关于我应该将 .htm 放在我的网址末尾吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆