[wp-hackers] Absolute vs. relative URLs

Jeremy Visser jeremy.visser at gmail.com
Sun Apr 22 09:21:01 GMT 2007


On 4/21/07, Leonid Mamchenkov <leonid at mamchenkov.net> wrote:
> Dear All,
>
> It seems that quite a few people suggested to use relative URLs in
> WordPress instead of absolute.  I've even seen some patches here and
> there (Trac).  But the status of the issue is not clear.
>
> What is happening with this?
>
> Absolute URLs is about the biggest problem in our
> development/deployment process for our customer's web sites.  Since
> most of them already have web sites online, we can't develop under the
> target domain.  We use a different host instead, and after everything
> is done and ready, we have to change the 'home' and 'siteurl' values
> in wp_options, 'guid' in wp_posts, and do a search-and-replace through
> the text of all pre-set posts and pages ('About us', 'Contact us', and
> whatever else the customer might have requested).
>
> While we managed to somewhat automate the process, it's still error
> prone and doesn't work very well in some situations, such as, for
> example, several domains per web site.

This has a problem with things like RSS feeds opening in external
viewers not working properly, and I also encounter problems with
things like pinging. WP should be smart enough to do this, but seeing
as though the market for relative URLs is smaller, it doesn't seem to
have been implemented.

Something like a wp_absolute_url($url, $base) function might be handy
for if you need to force an absolute URL.


More information about the wp-hackers mailing list