问题原文
原帖链接 · Mohammad Hossein Fattahizadeh · CC BY-SA 4.0
Should I use absolute paths for CSS or JS resources in <link and <script tags?
Is there any reason?
Some SEO optimization say fix it, should I do it for any reason?
I do not know why, if everything is working fine?
<link rel="stylesheet" href="/css/main_rtl.css?v=5e6e47e9">
<script src="/lib/js/frameworks.min.js?v=5e6e47e9"></script>
Vs
<link rel="stylesheet" href="https://sample.com/css/main_rtl.css?v=5e6e47e9">
<script src="https://example.com/lib/js/frameworks.min.js?v=5e6e47e9"></script>
Is there any SEO-related point?
Shorter version is smaller HTML at least.
- each page has canonical
- domain only serve https version(http redirect to https)
已采纳解答
原帖链接 · Don King · CC BY-SA 4.0
If your website is available on both http and https I definitely recommend using relative path and not absolute. Otherwise I cant really see any specific difference.
The SEO optimization services might recommend you to use absolute paths because it could in theory create some issues for them if you use relative path, but I would ignore that myself because I don't think it matter much for Google and other large indexers.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
