Relative URLs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux