Cons and advantages of the protocol-less-Urls "//site.org" vs "http://www.site.org"

As I’m not sure yet, what version for the solution is from http://www.site.org OR http://site.org (in the end I need to choose, but so far I can’t choose). In the meantime, I want to advertise my site online: post a link here or there. Now I was wondering if it would be a good idea to have bottomless hyperlinks, for example. //site.org as a URL!

Thus, URLs on the network will not be legible and will allow some space to be good with or without the WWW. Its simpler less, and it seems to work great in FireFox!

Questions
1. What are the pros and cons of using protocollless urls?
2. Why aren't other people used?

Thanks! Very curious for your understanding. Very much appreciated.

+6
source share
2 answers

Regarding the use of www.site.com or site.com for a website, there are good reasons to use them. Some argue that the only thing people will use your domain name for is to go to your web server, thus www. considered unnecessary by those who hold this opinion.

I personally prefer www.site.com, as you can create a CNAME record for this. This is useful if you ever need / need to host a site behind a CDN, as root domain names cannot be CNAME.

In any case, you will most likely need one that you do not use to redirect depending on what you are using, no matter where the user clicks, they will get to the server.

As for why people do not use //site.com or // www.site.com, I would prefer:

  • The thought of a link without a protocol is scary and seems strange ...
  • Most markup parsers probably also don't recognize it.
+6
source

The main reason for using these URLs is on a site that uses HTTP and HTTPS (with the same page). The idea is that links to static content on the page use // instead of http:// , inheriting the protocol from the page. This allows the client to add the correct protocol (so that the protected pages do not have “unsafe elements”) and eliminates the need to encode two versions of the page or has special “tricks” to change the protocol when creating the page.

For any URL other than this, without adding a protocol, this means that users can directly come to your site with an HTTPS request, adding unnecessary load to your site. I suggest explicitly specifying the protocol in such cases.


Regarding the question of using www or not, it depends on what else you will have on the server, and if you expect subdomains (if you add a blog, it will have blog.example.com URL or example.com/blog URL). If you expect subdomains, use www to designate the main site, if you cannot omit it.

+14
source

Source: https://habr.com/ru/post/886468/


All Articles