Web 浏览器是否总是在域名后发送斜杠? [英] Do web browsers always send a trailing slash after a domain name?

查看:29
本文介绍了Web 浏览器是否总是在域名后发送斜杠?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

浏览器如何向与尾部斜杠相关的主机发送 url 是否有一致性和/或标准?

意思是,如果我在网络浏览器的地址栏中输入 http://example.com,浏览器是否假设添加一个斜杠(http://example.com/) 与否?

解决方案

浏览器向服务器发送的 HTTP 请求不包含域名,只有路径"部分(从域名后的第一个斜杠开始)).由于路径不能为空,因此在这种情况下会发送 /.

对网站根目录的示例 GET 请求可能是:

<前>获取/HTTP/1.0

上面的/不能省略.

Is there consistency and/or a standard on how browsers send a url to a host related to trailing slashes?

Meaning, if I type in http://example.com in the address bar of a web browser, is the browser suppose to add a trailing slash (http://example.com/) or not?

解决方案

The HTTP request sent from the browser to the server does not include the domain name, only the "path" portion (starting from the first slash after the domain name). Since the path cannot be empty, a / is sent in that case.

A sample GET request for the root of a web site might be:

GET / HTTP/1.0

The / above cannot be omitted.

这篇关于Web 浏览器是否总是在域名后发送斜杠?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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