There is a code:

<h1 align='center'><a href='http://".$_SERVER['HTTP_HOST'].@dirname($_SERVER['REQUEST_URI'])."/'>Вход на сайт</a></h1> 

When you point to a link, the address appears:

 http://site.ru\/ 

and of course the link does not work. What is the problem?

    1 answer 1

     <h1 align='center'><a href='http://".$_SERVER['HTTP_HOST'].@dirname($_SERVER['REQUEST_URI'])."/'>Вход на сайт</a></h1> 

    Well @dirname($_SERVER['REQUEST_URI']) why? What is the task? Make a link to the site or how?

    // upd

    Maybe you have a page to enter the site, so put it in the link:

     <a href='http://".$_SERVER['HTTP_HOST']."/login'>Вход на сайт</a> 

    dirname opens a directory on a server, it is what you need?

    • Yes. So it was. There was an explicit link to the site. The problem arose when it began to move the pages to other directories. There is a need for global variables. Trying to figure out the navigation. How many did not read about global variables - did not understand. This code was found in the internet in the file forming an error 404. Pasted it into your file, and it turned out that it does not work. There are a lot of questions, but I will not ask everything - so I try to understand with one example. - Monstrs-Inc
    • Why does not appear slash in the address? Roughly speaking, if this variable is global and is not specified anywhere - why does it not work as it should? Sorry, maybe the question is stupid ...))) - Monstrs-Inc
    • @dirname($_SERVER['REQUEST_URI']) - this is not necessary for you. This puts you a slash at the end. - Artem
    • He should put a slash at the end, and there should be no backslash before him. Because of him, the link does not work. Perhaps it is not necessary - there are many ways to get around this, just wanted to understand the reason. On other sites, then for some reason they prescribe dirname . - Monstrs-Inc
    • @dirname ($ _ SERVER ['REQUEST_URI']) here in addition the parameter is passed, and you do not need it, just put a slash and that's it. I see this for the first time. - Artem