首页 > 解决方案 > 基础href URL html5

问题描述

我有一个像www.site.com这样的网站,我在上面使用了以下语言:

https://www.example.com/en/dashboard.html
https://www.example.com/es/dashboard.html
https://www.example.com/fr/dashboard.html
https://www.example.com/de/dashboard.html

我正在使用一个基本的href url:

<base href="www.site.com/">

如果我调用 css 文件或 js 文件,例如:

<link rel="stylesheet" href="assets/css/bootstrap-4.5.0.min.css">

它给出了该文件不存在,当我检查源代码并单击该文件时,我遵循以下网址:

https://www.example.com/en/assets/css/bootstrap-4.5.0.min.css

但是文件位于根域下:

/home/site/www/assets/css/bootstrap-4.5.0.min.css

不是在所有语言下。

那么我可以调用这些文件以获得这样的 url,而无需语言代码:

https://www.example.com/assets/css/bootstrap-4.5.0.min.css

标签: htmlhref

解决方案


推荐阅读