There is a site structure:

site client loginpage index.php mainpage index.php blogpage index.php server login.php savesession.php // Всякие другие скрипты 

When the server was started, the site selected as the working directory. This is done so that you can refer to scripts from the server folder from index.php . If you choose a client, then you will not be able to refer to these scripts (it seems that I could be completely mistaken, please correct it).
Everything works fine, it’s already written, but url doesn't like it.
That is, for the login page, the url will be like this: http://site/client/login .
How can I correct .htaccess so that the pages are: http://site/login , that is, simply without displaying the client folder?
In addition, it is very interesting whether it will be a purely visual effect or will you have to rewrite all the paths in scripts?

  • RewriteRule - changes the request, but does not change the URL. But if you specify a redirect, the URL will also change. Combine at discretion. In scripts, you will have to rewrite relative paths, since they are going from the URL - DNS
  • @DNS has never worked with htaccess. From googling and different examples I could not write the RewriteRule correctly. - VostokSisters
  • @DNS will be easier to simply change the structure of the project and the links on the pages. - VostokSisters

1 answer 1

If you use RewritwRule in .htaccess, it will be something like this (did not check!)

 RewriteEngine on RewriteRule ^login.php$ client/login/index.php [L] 

This is provided that I understood you correctly and the client is a folder, not a variable, and each client has its own. Accordingly, the url for the login at the client will look like http: //site.url/login.php and redirect it to http: //site.url/client/login/index.php

  • Well, it's too late, I redid the project structure, but thanks, I will know. - VostokSisters
  • I don’t think I understood correctly ... the client is just a folder for ready-made pages. There are no customers) - VostokSisters
  • Well, I can not run this example, but I do not need a redirect. I need a nice link in the address bar. - VostokSisters