Defining them in wp-config.php is a good start.
Hopefully you realize that this has already been done, and thats why you are saying that.
What do you mean? No part in wp-config.php allows me do define the site root URI and Unix path.
oh yes it does..
http://codex.wordpress.org/Editing_wp-config.php%23Advanced_Options
See how long that’s been around? Since 2.2.
Thats why we are constantly telling people to read the documentation.
And neither of those values are the UNIX path,
this is a path: /local/home/site/wordpress/
Both of those values are URLs (or URIs if you want be to current)
but thats neither here nor there, and I understood your point all the same. 🙂
Cool, thanks. Believe me, I do read the docs, and I had a hard time to find the info I was looking for. Having commented-out samples in the wp-config.php would save a lot of trouble.
That said, adding the relevant define(‘WP_SITEURL’, ..) and define(‘WP_HOME’, ..) statements in wp-config.php didn’t do much for URIs already existing in the db. Works for menus, does not work for images present in the pages (i.e. the ones in the uploads directory).
this is a path: /local/home/site/wordpress/
Yes, which is what I meant. The wp_postmeta table in the db contains unix paths for the image uploads in the media library. If that path is wrong, the images in the media library will be kaput. So those need to be changed too if I were to move the db from one host to another.
didn’t do much for URIs already existing in the db
True enough, and that can be an issue. However, there’s a few things to keep in mind here:
1. Hopefully, you’re not moving your site around all the time. Normally you want to keep sites in the same place, because how else will your readers find you? Therefore, moving sites is a rare event, in theory. Note that this is not the same as changing *hosts*. You can do that all you like as long as you keep your URLs the same.
2. Changing the database is simple and easy, really. When you make a backup of your database using, say, phpMyAdmin, then it generates a large text file, which is basically a dump of your entire database. You can load that into any good text editor (I like TextPad) and then do a simple search/replace to modify the URLs everywhere in the database. I’ve done this a few times, it’s easy and effective. Then, when you restore the database on the new host, everything is already changed.
Short answer is that it’s not something that you can easily automate anywhere, because it’s not something that will be the same process from move to move.
Re. point 1, I usually move the db between the localhost dev machine and the live site, i.e. not so much between WWW domains.
Re. 2, this exactly what I do (and also edit via TextPad 😀 ). Complications arise when the editor does not support the character set used by the database and ends up mangling it as a result. I suppose I could cook up SQL queries to search & replace entries, but it doesn’t change the fact that it is a tedious and redundant process.
Some CMS can isolate the database from host & domain specific information well (eg.: ZenCart and others) and doesn’t require external intervention when importing the db to another host. I was hoping one day WordPress could do the same.
Well, WordPress does do that for all it’s own internal functions and such, but your post content is another matter entirely.
Would it be possible to add content using relative URI paths rather than absolute?