If the domain is: site.com then you can write it like this:
<script src="http://site.com/asset/style.css"></script>
BUT if the user has thrown the archive of the site into a subfolder, then this option is no longer suitable.
You can register as:
$url = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
There will be such a link:
<script src="http://site.com/подпапка/asset/style.css"></script>
But if the user goes into another folder, then this option is not suitable either, for example: http://site.com/subfolder/admin/ styles will be:
<script src="http://site.com/подпапка/admin/asset/style.css"></script>
it should be like this:
<script src="http://site.com/подпапка/asset/style.css"></script>
How to do it correctly, what would the links work in folders and subfolders, etc? For example, in the wordpress engine everything works as it should. I did not find the code I found as they did, I want to do the same for myself.
base
tag, and all styles are loaded along a relative path - BOPOH