I see on some sites that use the https protocol, the link to their sites is not

https://site.ru..#не такие ссылки //site.ru. #а вот такие 

And as I understand it, the Apache or another system itself determines and transfers to the desired protocol.

Question.

You need to write this "check" of the protocol yourself, or the Apache (in my case) will determine for himself if I will transfer to myself through the address:

 //site.ru 
  • 2
    Nobody throws anything. If there is no site specified in the link, then the link leads to the current site. Similarly, if no protocol is specified - the link leads to the site with the current protocol (by which the page on which this link is open) - Mike

2 answers 2

Not Apache Server adds the protocol, but the browser. The request comes to the server already with the protocol. On the server side, you need to configure the processing of the necessary protocols and that's it.

    This is a pure front-end thing, apache (or any other web server has nothing to do with it). Such a link, without a scheme, tells the browser to use the same protocol that it used to access the page on which this link is located.

    Example:

    On the site example.org is a page some_page.html , it has a link <a href='//example.com/another_page.html'>click me</a> (pay attention: another domain).

    If you refer to the page at http://example.org/some_page.html then click on the link will send a request to http ( http://example.com/another_page.html ).

    If you refer to the page at https://example.org/some_page.html then click on the link will send a request to https ( https://example.com/another_page.html ).

    This is <a href> not only for <a href> , but also for any other places where url used (loading images, styles, scripts etc). Perhaps there are rare exceptions, I do not remember, it is worth clarifying.

    The meaning is this: there is no need to download additional resources (styles, scripts, images) via https if the main page is still loaded via http and its content can modify the "man in the middle" as you like. On the other hand, it is not reasonable (and often simply impossible) to upload resources via http to a page downloaded via https .