giovedì 19 settembre 2013

How to upload WordPress Blog to New Domain or Location from localhost or Old Domain

For blogger who self-hosts the WordPress blog publishing system on a web hosting server with own registered domain name, sometimes, you may decide to reorganize the blog link URL to make it tidier or to reflect new focus or theme of the blog. If you decide to change the URL or link location of your WordPress blog due to changing of domain name (such as from http://www.old-domain.com/ to http://www.new-domain.com/) or the blog to another directory location (such as from http://www.domain.com/ to http://www.domain.com/blog/), there are some steps that should be done to ensure the proper migration and no breaking links.

The tricky part when moving WordPress blog to another location is that WordPress is using absolute path in URL link instead of relative path in URL link location when stores some parameters in database. Within blog posts’ contents itself, users may also use the old URLs when creating reference backlinks. All these values in the database will need to be changed when WordPress is moved. The following guide will show you which database fields that has references or values related to blog’s URLs that you want to modify. Note that this guide is not about how to move WordPress blog from one server or host to another new hosting service.

Once the blog has been moved (all files copy over in case of moving location or server or new domain name properly propagated across Internet for new domain name), the first thing to change is to tell WordPress the new blog location (wp-config.php should be no changes, and .htaccess file should be also no changes. If for some reason mod_rewrite rules for friendly URLs no longer works, you can always regenerate the .htaccess file via WP Administration’s Update Permalinks page).
This value can be changed via WordPress Options page, but if you no longer able to access to old blog URL, you have to modify the value via MySQL database.
Note: The guide uses SQL statements based on MySQL replace() function to modify the database. To run SQL queries, login to MySQL database that houses WordPress tables via phpMyAdmin or login to the DB server and run MySQL client as root.

To update WordPress options with the new blog location, use the following SQL command:

UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';

After that you will need to fix URLs of the WordPress posts and pages, which translated from post slug, and stored in database wp_posts table as guid field. The URL values in this field are stored as absolute URLs instead of relative URLs, so it needs to be changed with the following SQL query:

UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');

If you have linked internally within blog posts or pages with absolute URLs, these links will point to wrong locations after you move the blog location. Use the following SQL commands to fix all internal links to own blog in all WordPress posts and pages:

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');

Browse through WordPress blog to check if everything is okay. You also need to re-login to WP Administration as authentication cookie has now became invalid due to different domain.

26 commenti:

  1. Nice article...this post is outstanding in regards of both information as well as information.thanks for talking about you post with us.

    RispondiElimina
  2. I am very happy when read this blog post because blog post written in good manner and write on good topic. Thanks for sharing valuable information…....

    RispondiElimina
  3. I show up record it. I ache for to catch included this topic…i am respecting the time and fulfillment you put in your site,

    RispondiElimina
  4. Nice article...this column is outstanding in commendations of both advice as able-bodied as information.thanks for talking about you column with us.

    RispondiElimina
  5. Thanks for this admirable column ..lots of acknowledgment for you on this...by
    mgt 498 week 2 provider.

    RispondiElimina
  6. Thanks for this admirable column ..lots of acknowledgment for you on this...by
    mgt 498 week 2 provider.

    RispondiElimina
  7. Thanks for such innovative and astonishing information..Good here is really pleasant information.
    by HomeworkHelp provider

    RispondiElimina
  8. You are so cool! I do not think I have read something like this before. So wonderful to discover someone with some original thoughts on this subject matter. someone with a bit of originality!..... by
    mth221week5 provider.

    RispondiElimina
  9. Great column like this charge be awful recommended. It is so nice to apprehend such admirable blog. Thanks for sharing! Have a affable day ahead....by
    mth221week4 provider.

    RispondiElimina
  10. Great column like this charge be awful recommended. It is so nice to apprehend such admirable blog. Thanks for sharing! Have a affable day ahead....by
    mth221week4 provider.

    RispondiElimina
  11. This blog is actual arresting and you are accommodate best abstracts for users. I commonly travelled to your blog site.Thanks for your arresting administration .I accept abstraction your website and I got actual accessible and accomplished minutia from your website..by
    mth221week1 provider.

    RispondiElimina
  12. I am very happy when read this blog post because blog post written in good manner and write on good topic. Thanks for sharing valuable information…....
    mth221week1 provider.

    RispondiElimina
  13. Iam really glad that I have gone through a great post.keep posting these type of Articles which would be useful for everyone...please visit our website for more info:
    mth221week2 provider.

    RispondiElimina
  14. Hi,Having a beautiful website no one can find is like having a store and keeping the doors locked. I know it is there, you've done a great job decorating Web Design Cochin, the products are waiting for the customers, yet no one comes in.Thanks....
    mth221week3 provider.

    RispondiElimina
  15. Interesting blog and it contains very useful informations about blogs creations... thanks for posting....
    by ACC 205 provider

    RispondiElimina
  16. This is really wonderfull blog mail. I observed this blog farther more useful data. Thanks for sharing your useful outlooks.
    by MKT 421 Individual Assignment provider

    RispondiElimina
  17. thank god..this helps me a lot.m searching for thing like this website development company in coimbatore

    RispondiElimina
  18. this is the informative site..it is wonderful thank you for providing this information...

    RispondiElimina
  19. Great notion about world wide web conceive tips.Its helpful for all the beginners.Thanks for distributing this information..Keep up your work.
    by STR 581 Entire Course Provider

    RispondiElimina
  20. wow that must be greatest one ,because this as very informative site ,thank you so much for your wonderful jobsmosquito net in coimbatore

    RispondiElimina
  21. thank you for sharing how to use wordpress blog to change the domain as well outdoor advertising agencies in coimbatore

    RispondiElimina
  22. thank you for sharing such a very useful information..done a good job
    paneer manufacturers in coimbatore

    RispondiElimina