Image source: Relative Path or URL?

It’s best to use relative paths instead of URLs. It just doesn’t just save up space(which helps your site load faster) it also helps from hotlinking.

FALSE. The type of path you use makes absolutely no difference as to whether people can hotlink your images.

If I visit your website, and there is an image referenced in the page, the URL interpreted by my browser will be the same whether you have used a relative, root or absolute path. If I right-click on the image and select “Copy image location” (or whatever phrase your browser of choice uses), that will give me the complete and absolute URL of the image, regardless of whether you have used a relative, root or absolute reference in the page.

Anyone who is savvy enough to look at the source code for the image URL will almost certainly be savvy enough to piece together a relative reference with the address of the page to produce a complete URL for the image.

In addition to Stevie D’s comments, while shorter relative pathnames use less characters (and thus less characters are used in the document in question) I would be hard pressed to believe that the speed difference would be noticable (granted, having said that, I have nothing against squeezing the document size down as much as can be realistically done).

IMO, the greater advantage to relative paths is what others have mentioned; ease of use on either localhosts or live production servers without fussing over pathing when going from one to the other.

Same as I am…


yes, always it would be best to give the relevant path, instead of giving all URLs.