我不知道这是可以通过的.htaccess或其他任何方式来告诉设置基本URL。
I wonder if this is possible to tell via .htaccess or any other manners to set a base URL.
示例
我在index.php CSS设置这样
My CSS in the index.php is set like this
<link rel="stylesheet" href="css/style.css"/>
一切工作正常,当我在第一个目录载入我的文件和网页。但是,当我有这样/page/index.html文件夹中设置页面。的CSS未加载,因为文件夹不在页/,但在根目录
Everything works fine when i'm on the first directory to load my file and pages. But when I have a page set in a folder like /page/index.html. The css isn't loaded because the folder is not in page/ but in the root directory.
所以是可以告诉它从根目录总是看加载CSS,图片,JavaScript等还是我必须设置完整的URL路径,我想加载(CSS,图片,JavaScript每一个元素,等等)?
So is that possible to tell it to look always from the root directory to load the CSS, images, javascript, etc or I have to set the full url path to each element I want to load (CSS, images, javascript, etc)?
感谢
使用基本URL,例如: -
Use Base URL, for example:-
<html>
<head>
<base href="https://m.xsw88.com/allimgs/daicuo/20230902/144.png.gif" width="24" height="39" /> - Notice that we have only specified a relative address for the image. Since we have specified a base URL in the head section, the browser will look for the image at "https://m.xsw88.com/allimgs/daicuo/20230902/145.png.gif"
<br /><br />
<a href="http://www.w3fools.com">Don't use W3Schools</a> - Notice that the link opens in a new window, even if it has no target="_blank" attribute. This is because the target attribute of the base element is set to "_blank".
</body>
</html>