How to change the Site URL

Discussion in 'WordPress' started by sanpan, Nov 20, 2010.

  1. #1
    Hi!

    my friend got a wordpress MySql database from someone and He imported the database and setup the site. But all the links points to the old URL ( the URL's setup in the original database ).

    How to make all the links point to his own URL.
     
    sanpan, Nov 20, 2010 IP
  2. walkingbird

    walkingbird Member

    Messages:
    290
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    30
    #2
    1. Log into phpMyAdmin.
    2. Backup your database and save the copy off-site.
    3. Login to phpMyAdmin.
    4. Click the link to your Databases.
    5. A list of your databases will appear. Choose the one that is your WordPress database.
    6. Look for the name of the table within your database used to hold your post information. Usually it is called wp_posts, but it may have been changed. Write it down.
    7. Clicking the Browse icon or link, open the wp_posts table.
    8. Look for the field that holds your post "guid". It is usually called guid, but it may have been changed. Write it down.
    9. Click the tab at the top for SQL.
    10. Using the information you wrote down from above and the old and new URL addresses you wish to update or search and replace within your database, type in the following (CAREFULLY):

    UPDATE wp_posts SET guid = REPLACE (
    guid,
    'http://exampleoldsiteurl.com',
    'http://examplenewsiteurl.com');

    1.
    1. Make sure that the names of wp_posts and post_content match the tables and fields within your database. Change them if not.
    2. Ensure that the ONLY content you want to change are within the little single 'quotes' . Make sure EVERYTHING is spelled right and that you are sure this is correct.
    3. Review everything within the SQL input box again. Make sure it is correct. There are no second changes when you take the next action. The change is permanent.
    4. When you are sure, click Go.
    5. At the top of the screen will be generated a list of how many of the tables and fields have been changed.
     
    walkingbird, Nov 20, 2010 IP
  3. sanpan

    sanpan Member

    Messages:
    552
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    28
    #3
    Thanks. I will do the same.

    Also, I read on the wordpress site the following, does it help ? I never tried this.



    Edit wp-config.php

    It should be possible to fix the site URL using a new feature -

    Add these two lines to your wp-config.php, where "example.com" is the NEW location of your site.

    define('WP_HOME','http://example.com');
    define('WP_SITEURL','http://example.com');

    This is not necessarily the best fix, it's just hardcoding the values into the site itself. You won't be able to edit them on the General settings page anymore when using this method.
     
    sanpan, Nov 20, 2010 IP
  4. nileshnirale

    nileshnirale Active Member

    Messages:
    329
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #4
    i was also looking for same solution .... i used to import the sql database and then change the url from wordpress admin..
     
    nileshnirale, Nov 20, 2010 IP