Steven
Steven

Reputation: 19425

Should I use relative or absolute url on my website?

If I'm not moving my site around, any good reason for why I should use absolute URL's over relative?

Upvotes: 5

Views: 809

Answers (3)

user377628
user377628

Reputation:

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.

Upvotes: 0

Ryan McDonough
Ryan McDonough

Reputation: 10012

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

Upvotes: 3

Zachary Kniebel
Zachary Kniebel

Reputation: 4774

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.

Upvotes: 1

Related Questions