In the project, all the "links" are written relative to the root of the site -

in index.php:

<link type="text/css" rel="stylesheet" href="/css/reset.css"/> <link type="text/css" rel="stylesheet" href="/css/styles.css"/> <link type="text/css" rel="stylesheet" href="/css/styles-media.css"/> 

When building a project with Gulp-ohm + MAMP (the project path is MAMP/htdocs/polissya.in/ ), errors are displayed in the console:

 (index):7 GET http://localhost:8002/css/reset.css (index):8 GET http://localhost:8002/css/styles.css (index):9 GET http://localhost:8002/css/styles-media.css 

The URL in the browser is http://localhost:8002/polissya.in/build/ - why does it take links not relative to this URL, but relative to http://localhost:8002/ ? The path should be this way - http://localhost:8002/polissya.in/build/css/reset.css ?

If you register for example not href="/css/reset.css"/> , but href="css/reset.css"/> then everything is tightened up normally - but you need to save such paths as they are, as there is more in the project A lot of PHP "constructs" with exactly such paths.

If you put the contents of the 'build' folder in the root of MAMP/htdocs/ then everything starts working as the paths "converge" (but this option is not very acceptable and I still want to figure it out). On the hosting, too, everything works fine.

Tell me, please, "which way to look" to solve the problem.

  • all css should be on the same "wave" with index.php, if you want to save the paths, create something like AssetBundle and pull up with respect to <link type = "text / css" rel = "stylesheet" href = "/ css / reset. css "/> - Lieutenant Jim Dangle
  • Thank you for the answer - but I would like to deal with localhost, if there is such an opportunity - Aleksandr

0