Home > Backend Development > PHP Tutorial > 域名访问 HTTP_HOST 奇怪的现象

域名访问 HTTP_HOST 奇怪的现象

WBOY
Release: 2016-06-06 20:29:24
Original
1306 people have browsed it

现象

<code>访问域名 http://www.a.com. 注意,结尾有一个.,打印$_SERVER

$_SERVER['HTTP_HOST'] ==> www.a.com. (结尾有一个 .)
$_SERVER['REQUEST_URI'] ==> /</code>
Copy after login
Copy after login

系统

<code>centos7 + nginx 1.6.8</code>
Copy after login
Copy after login

. 默认的附加到域名上了

回复内容:

现象

<code>访问域名 http://www.a.com. 注意,结尾有一个.,打印$_SERVER

$_SERVER['HTTP_HOST'] ==> www.a.com. (结尾有一个 .)
$_SERVER['REQUEST_URI'] ==> /</code>
Copy after login
Copy after login

系统

<code>centos7 + nginx 1.6.8</code>
Copy after login
Copy after login

. 默认的附加到域名上了

根域

域名最后多个.实际上才是正规的写法。就是所谓的FQDN,Fully-Qualified Domain Name。

最后一个点用于区分以root label结尾的完整域名,和在本地域名内的相对域名。就好象*nix下绝对路径以/开头,不以/开头的就是相对路径一个道理。

参考文档:Trailing Dots in Domain Names

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template