K
K
Konstantin Vlasov2021-01-30 23:19:11
Apache HTTP Server
Konstantin Vlasov, 2021-01-30 23:19:11

How to configure Apache so that short links lead to the site's root directory?

Hello!
My problem is this: I've always been working on OpenServer on Windows and living happily ever after, and all of a sudden I got a Mac and had to install Mamp. Installed without problems, threw the directory with the site into the htdocs folder, went to the address

http://localhost:8888/название_папки_с_сайтом/index.html
and the links did not work, as did the styles and separately connected scripts. They are loaded locally in the site code, starting with a slash, for example, "/contacts/index.html", and the slash, as I understand it, in this situation, as I have, does not lead to the root directory of the site "folder_name_with_site", but to the root directory of the server, those. in htdocs.

I solved the problem by dumping the entire contents of the site directory directly into htdocs, but I would like to know how to configure Apache so that the links lead exactly to the root directory of the site? So far, my solution works, but what if I want to put 2 sites on my local server?

Googled a lot, found several solutions, but none helped me, maybe I did something wrong, so I decided to ask here.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question