The website I work with uses mod_rewrite to create nicer urls, but a result of this is that we have to put the full path to images etc within javascript include files.
I would like to avoid doing this, so that the include files can be easily transfered to different websites without the need for modifying them.
Eg
If scripts.js is included from the following URL:
http://www.domain.com/prodname/prodsub/name.phpThe following code would not work:
var arrowheadimg=["./ukimgs/ar
rowdown.gi
f"] //path to down and up arrow images
as it looks for the image at
http://www.domain.com/prodname/prodsub/ukimgs/arrowdown.gifwhere as the image is actually in:
http://www.domain.com/ukimgs/arrowdown.gifNB: I can't just put few extra ./../../ on the image reference as the script will be used by many pages that have different number of params from the mod_rewrite and so varying length.
Thanks
Start Free Trial