首页 > 解决方案 > 资源未加载到网页上

问题描述

我编写了简单的 HTML 和 CSS 文件并将它们上传到我的服务器,但是这些 CSS 和 HTML 文件没有被正确读取。当我在本地测试它时它工作正常,但当我将它上传到我的服务器时它不起作用。

这是我的树:

.
|-- assets
|   `-- icon.png
|-- index.html
|-- pages
|   |-- about.html
|   |-- certificates.html
|   |-- programmingLanguages.html
|   |-- projects.html
|   `-- socials.html
`-- styles
    |-- base_style.css
    `-- indexpage.css

我试过“/styles/indexpage.css”、“./styles/indexpage.css”和“syles/indexpage.css”。我什至用“/var/www/suchcodes/styles/indexpage.css”尝试了绝对路径,但这些都不起作用......

请帮忙。网页:suchcodes.info

标签: htmlcssnginxserver

解决方案


可能在服务器上 .htaccess 正在更改请求的路径。您应该使用动态构建的路径,例如 url('/styles/indexpage.css') 转换为www.mysite.com/styles/indexpage.css


推荐阅读