Is using absolute paths for images / scripts a good idea?

I have a website where I update the urls for example to rewrite to be more SEO friendly. By doing this, it broke many script / image links on different pages. The only way around this (from what I can tell) is to use the absolute path to scripts / images in the pages.

Now if I'm not mistaken (or missing something) this should be pretty safe? Anyone who knows anything about websites and / or web development will be able to develop directories for images / scripts simply by looking at the current url and matching against relative paths.

I would like to know if there are any real reasons why this would be a problem.

Thank.

+2


source to share


2 answers


There are no security implications, but it will make life harder for you if you ever move your site (to a different domain, for example) as you have to update all URLs from http://www.example.com/media/mynicepicture.jpg

to http://www.mynewexample.com/media/mynicepicture.jpg

. If you are using relative urls, you dont need to update your urls if / when moving domains.



+4


source


There are absolutely no security implications for using absolute URIs instead of relative URIs.



+3


source







All Articles