问题
If I'm not moving my site around, any good reason for why I should use absolute URL's over relative?
回答1:
Absolute URL's will work no matter if you move the content from folder to folder, however each language will have a way to reference a BASE URL in one way or another.
For example if you have "test/1.html" as a URL on index.html it will redirect to /test/1.html however if you copy that link to /dom/index.html it will redirect to /dom/test/1.html
It would be best practice to use the base URL and then the relative URL e.g. {BASE URL}/test/1.html
回答2:
I tend to prefer using relative because if you ever make any changes to the site relative urls tend to be much more adaptable.
If you are talking about efficiency, there is no real difference between the two.
回答3:
If I'm not moving my site around [...]
This will come up one day. Even if you're just moving your site from one folder to another, you want the links to be relative. You may not think that will ever happen, but it's better to be safe than sorry.
来源:https://stackoverflow.com/questions/11688826/should-i-use-relative-or-absolute-url-on-my-website