Answer the question
In order to leave comments, you need to log in
How to set scripts and styles for localhost?
There is a setting in the Apache config:
DocumentRoot "e:/Desktop/Server/data/htdocs"
Actually, localhost "starts" from here.
How (apart from the browser add-on) can be attributed to the localhost'a js/styles/php page? And is it technically possible?
Answer the question
In order to leave comments, you need to log in
styles and js can be applied to any html page, no matter where it is located. It is difficult to understand from your question what you mean by localhost, I assume that some page that is loaded in the browser. Accordingly, just add links to css and js in its head
links to localhost:
href="css/style.css" - in the current directory in the css folder style.css file
href="/css/style.css" - from the site root css folder style.css file
href="../ css/style.css" - exit the current directory to a higher level, find the css folder in it and load the style.css file
If I understood the question correctly, then in order to connect the styles, I did the following on Openserver, where Apache 2.4.
Made changes to the server configuration file for the HeaderName and IndexOptions directives for the mod_autoindex module.
It became like this:
HeaderName /include/HEADER.html
IndexOptions SuppressHTMLPreamble FoldersFirst FancyIndexing HTMLTable VersionSort NameWidth=*
HeaderName contains a file that is included at the top of the page (placed in the include directory)
Only the SuppressHTMLPreamble directive has been added to IndexOptions. It removes the html from the top of the page, which is there by default.
In the header.html (the usual top of the html file), you need to remove everything after the body tag (this was in the Apache documentation itself), respectively, write the styles you need in the head tags. There is also an IndexHeadInsert directive for the same mod_autoindex, but it only works on the first page, as you can guess from the name. You could probably still look in the mod_autoindex documentation, but I stopped there. When I open localhost, I see this (of course, only when I just navigate directories):
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question