Reply to Relative URLs

Your name:

Reply:


Posted by Pedro Fayolle on 02/21/05 17:18

Hi,

I wanted to gather opinions on what method is best for dealing with
relative URLs (i.e. in HTML links) on complex, multi-level directory
structures.

Here's what I have so far...

Goals:

1. Simpliest possible management of relative URLs.
2. Be able to move the entire site from one directory to another
without breaking links.
3. Be friendly with clean URL methods, such as using special query
strings like "server.com/index.php/products/item/10".

Methods:

Using static absolute URLs ("/absolute/path/") should of course be
considered obsolete as it doesn't comply with goal #2.

One possible method I tend to use is to transform all relative paths
into absolute with PHP before sending the document. This is a very
efficient but rather annoying method to work with, as most URLs need
to be pre-processed.

Another, generally cleaner method is to use the HTML base tag, which
allows one to define a base path for every relative URL found in the
document. This is however a nuisance whenever you need to link back to
the current document, such as with a regular relative query string
("?search=XX") or with a fragment link ("#section"), as the browser
would make them relative to the base path, forcing one to use the long
absolute URL each time.

Please tell me which you generally think is better and why, and if you
know any other method I could've missed.

Thanks,

Pedro Fayolle

[Back to original 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

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