Forum Moderators: open

Message Too Old, No Replies

need help keeping link paths the same

         

icpooreman

4:30 pm on Jul 7, 2005 (gmt 0)

10+ Year Member



I'm building a website and many of the pages are in different folders in different levels of the site. I have a basic template for the site and want to link many parts of the site to the same things e.g. images, css where I don't have to change all of the paths to images if I put a site in a new folder on a different level.

Now I know I could do this using a URL e.g. <img src="asdfals.com/images/whatever" /> but my site isn't online yet and don't yet know what my domain name will be. Is there a way to specify a link starting from the home dir. For example can I specify root/images instead of ../../../images

encyclo

6:05 pm on Jul 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The best way is to use an initial slash, which means that the path starts from the document root:

<img src="[b]/[/b]images/file.jpg" alt="">

That will work in all the subdirectories of your site, assuming that the

images
directory is in the document root.

icpooreman

6:46 pm on Jul 7, 2005 (gmt 0)

10+ Year Member



It doesn't seem to be working for me do I need to label any of my folders anything special for it to know where the root is? Right now all of my files are just in a folder on my desktop.

drock

6:54 pm on Jul 7, 2005 (gmt 0)



I had the same problem and it seemed to resolve itself when I uploaded my page to my domain. All my images seemed to magicallly appear where before they wouldnt. Good luck :)

icpooreman

6:57 pm on Jul 7, 2005 (gmt 0)

10+ Year Member



actually I did get it to work but I had to write \Documents and Settings\All Users\Desktop\site/images is there any way to mark my root folder so that I can just have /images so that when I move this folder to a new cpu in a new location I don't have to change all the paths

maswee

6:02 am on Jul 11, 2005 (gmt 0)

10+ Year Member



i will suggest you to have absolute urls to make it search engine friendly.