You are here: Absolute or relative paths « HTML « IT news, forums, messages
Absolute or relative paths

Posted by Peter Smith on 10/08/07 09:10

Hi all

I've noticed that some websites use absolute paths when linking to local
files, e.g. '/', '/style.css, '/images/logos/header.gif' etc., which has
the advantage that pages in subdirectories can use the same paths as
pages in the root, but also has the disadvantage that the site has to be
developed in the root folder (htdocs) rather than a subdirectory
(htdocs/myproject).

And some sites use relative paths ('images/logos/header.gif' or
'../images/logos/header.gif' if the page is in a subdirectory of the
root) which has the advantage that the site can be put in any directory
and the paths will work, but the disadvantage that calling functions
that create HTML or including chunks of HTML can be a problem because
the paths will need to change depending on the directory of the page
using the HTML.

Other sites seem to use a combination -- linking relatively to some
files but absolutely to others.

I'm never really sure which route to take. Are there reasons for
choosing absolute or relative paths that I'm not aware of?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация