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

Ankur Oberoi aoberoi at gmail.com
Sat Dec 4 18:46:43 UTC 2010

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.

More information about the wp-hackers mailing list