WordPress.org

Ready to get started?Download WordPress

Forums

Please make moving between servers and domains easier (9 posts)

  1. Tachikoma
    Member
    Posted 6 years ago #

    I have one and only one request:

    Make WordPress less a pain in the butt when moving databases from one server and/or domain to another. I find it really cumbersome to search and replace absolute URI links and server Unix paths within WordPress databases every time I shift hosts.

    Why can't site root URI and Unix path be defined in one location only? Defining them in wp-config.php is a good start.

    For the most part, I develop on my localhost, then end up uploading the finished product to my client's host. Often I find myself downloading databases from my client's hosts for debugging and backup purposes, but each and every time I have to hack the databases for the aforementioned reasons.

    It would be nice if future releases of WordPress would put this nonsense to an end, in fact I was hoping this would be fixed in v2.5.

    Anyway, WordPress is a really nice CMS. My clients love em and I like working with it, and I hope future releases will be more friendly with moving house.

  2. whooami
    Member
    Posted 6 years ago #

    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.

  3. Tachikoma
    Member
    Posted 6 years ago #

    What do you mean? No part in wp-config.php allows me do define the site root URI and Unix path.

  4. whooami
    Member
    Posted 6 years ago #

    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. :)

  5. Tachikoma
    Member
    Posted 6 years ago #

    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.

  6. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    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.

  7. Tachikoma
    Member
    Posted 6 years ago #

    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 :D ). 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.

  8. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Well, WordPress does do that for all it's own internal functions and such, but your post content is another matter entirely.

  9. Tachikoma
    Member
    Posted 6 years ago #

    Would it be possible to add content using relative URI paths rather than absolute?

Topic Closed

This topic has been closed to new replies.

About this Topic