[wp-hackers] Relative vs. Absolute URLs stored in db

Chris Williams chris at clwill.com
Sat Dec 4 18:58:15 UTC 2010

This horse was quite recently beaten nearly to death in the thread "WP Development & Production Sites"...

I fear a replay.

From: Ankur Oberoi <aoberoi at gmail.com>
Reply-To: <wp-hackers at lists.automattic.com>
Date: Sat, 4 Dec 2010 13:46:43 -0500
To: <wp-hackers at lists.automattic.com>
Subject: [wp-hackers] Relative vs. Absolute URLs stored in db

It doesn't seem to make sense to me that the absolute URLs are stored in the
db. Shouldnt those be formed by concatenating the siteurl and/or blog values
which are already stored in the db.

The main advantage of this would be that migrating a blog would be MUCH
simpler and straightforward. This problem is encountered when moving a site,
but much more of interest to me is when pushing from a dev environment to a
staging or production environment. Currently I would have
http://localhost/example as a site url which gets written to many places in
the database but when I want to push to http://example.com I have to use the
Search and Replace plugin to try and change all the URL occurrences. I have
to do this everytime I check my development code out of my version control
to another system. Seems like a bad hack considering I could be blogging
about tech and have "localhost" text in the content of a post that i do NOT
want to replace. I need to perform the operation on the content body because
media contained in the library is referenced with absolute URLs.

I just want to open up the discussion because there is possibly a good
reason to do it the way its done now, or a plan in place to change it, that
I am not aware of. Is it too expensive to do the concatenation at runtime?
That's the only benefit I could see from the current method.
wp-hackers mailing list
wp-hackers at lists.automattic.com

More information about the wp-hackers mailing list