There is such a thing as a
root domain , respectively, at the end of each domain there is a point. You may not even suspect that your site is accessible by a domain name with a dot at the end (domain.zone.), Since browsers allow you to access sites with or without a dot at the end of the domain.
Here you can read more about the full and relative domain names.
Possible problems
If you do not take into account the fact that a user may accidentally enter a domain name with a dot at the end or follow the link from the “well-wisher” and get to the domain name of your site with a dot at the end, there is a possibility of the following unforeseen situations:
1) If the website works over HTTPS, when accessing the domain name with a dot at the end, the browser will issue a warning about an untrusted connection, which the user will be somewhat surprised by.
')
2) Authorization may not work, because Cook often placed on the domain name without specifying a dot at the end. The user in this case will long wonder why he can not log in. It is noteworthy that if you set a cookie on a domain name with a dot at the end, it will NOT be transferred to the domain name without a dot at the end and vice versa.
3) JavaScript on the page may break if the probability of access to the site by the domain name with a dot at the end is not taken into account, which is unacceptable for substantial resources.
4) There may be problems with caching pages on the site (for example, the same
www.cloudflare.com simply does not allow clearing the cache of individual pages with a dot at the end, indicating that the wrong domain name is indicated).
5) If you rely on a specific domain name (
% {HTTP_HOST} in Apache,
$ http_host in Nginx) in a web server configuration without a dot at the end, a variety of unforeseen situations are possible: unexpected redirects, wonders with basic authentication and etc.
6) If the web server is not configured to service a domain name with a dot at the end, the user, by accidentally typing a dot at the end of the domain, will see something like: Bad Request - Invalid Hostname.
7) Theoretically, search engines may consider that duplication of content takes place on your resource if someone accidentally or intentionally places links to pages on your site with a dot at the end of the domain name (if you have information about whether the search engines perceive the domain. zone and domain.zone. as one domain - welcome to comments on the topic).
Decision
To avoid part of the above problems will allow redirect from a domain name with a dot to a domain name without a dot:
Apache (.htaccess)RewriteCond %{HTTP_HOST} !^domain\.zone$ RewriteRule ^(.*)$ http://domain.zone/$1 [L,R=301]
Nginx (nginx.conf) if ($http_host != 'domain.zone') { return 301 http://domain.zone$request_uri; }
IIS (web.config) <httpRuntime relaxedUrlToFileSystemMapping="true"/> <rule name="point" stopProcessing="true"> <match url="^(.*)\.$" /> <action type="Redirect" url="{R:1}" redirectType="Temporary" /> </rule>
Reconnaissance
Facebookhttps://www.facebook.com.Redirects to
www.facebook.com (after an agreement with a warning about an untrusted connection).
Megauploadhttps://mega.co.nz./#loginAuthorization successfully works, but after switching to a domain without a dot at the end of
https://mega.co.nz , the user is considered unauthorized.
Stack overflowhttp://stackoverflow.com.Bad Request - Invalid Hostname
HTTP Error 400. The request hostname is invalid.
Githubhttps://github.com./loginAuthorization does not work.
Twitterhttps://twitter.com.404 - Page not found.
Yahoohttps://login.yahoo.com.Authorization does not work.
Wikipediahttp://en.wikipedia.org./w/index.php?title=Special:UserLoginAuthorization does not work.
MSNhttp://msn.com.Bad Request - Invalid Hostname
HTTP Error 400. The request hostname is invalid.
Microsofthttp://microsoft.com.Bad Request - Invalid Hostname
HTTP Error 400. The request hostname is invalid.
ebayhttps://signin.ebay.com./ws/eBayISAPI.dll?SellItemAuthorization successfully fulfills.
Tumblrhttp://www.tumblr.com.Not found.
Flickrhttp://www.flickr.com.Sorry, Flickr does not allow embedding in an iframe.
Dropboxwww.dropbox.com./loginError (403) It seems you were trying to do something strange. Did you log in to another Dropbox account in the next window?
VKhttp://vk.com.Authorization does not work.
JavaScript Error: "NS_ERROR_DOM_BAD_DOCUMENT_DOMAIN: Illegal document.domain value" vk.com. (line 41)
Alexahttps://www.alexa.com.Redirects to
www.alexa.comYandex Mailhttps://mail.yandex.ru.Authorization successfully fulfills and redirects to
mail.yandex.ru/neo2/#inboxYandex Searchwww.yandex.ru .
JavaScript Error: “NS_ERROR_DOM_BAD_DOCUMENT_DOMAIN: Illegal document.domain value”
www.yandex.ru . (line 5)
Habrahabrhttp://habrahabr.ru./login/Authorization does not work.
Mail.ruhttp://mail.ru.Configured redirect to
mail.ruhttps://e.mail.ru./cgi-bin/loginAuthorization does not work.
UPD:1) In Nginx, you will not be able to configure a virtual server by specifying a fully-qualified domain name as server_name (
# comment_6011533 ):
server { server_name domain.zone. ; ... }