Skip to main content

Changing The Site URL « WordPress Codex

Popularity Report

Total Popularity Score: 0

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Rank

Related Lists

Bookmark History

Saved by 13 people (-5 private), first by anonymouse user on 2007-03-20


Public Comment

on 2008-02-28 by jgentry

Changing the WordPress site url.

Public Sticky notes

access the database

Highlighted by scootermac315

1. FTP to the site, and get a copy of the active theme's functions.php file. You're going to edit it in a simple text editor (like notepad) and upload it back to the site.

2. Add these two lines to the file, immediately after the initial "<?php" line.

update_option('siteurl','http://example.com/blog');
update_option('home','http://example.com/blog');

Highlighted by liishygo

5. Repeat the above steps, but remove those lines. IMPORTANT: Do NOT leave those lines in there. Remove them immediately after the site is up and running again.

Highlighted by scootermac315

Domain Name Change

Highlighted by liishygo

Look for the field that holds your post "guid". It is usually called guid, but it may have been changed. Write it down.

Highlighted by liishygo

Images link: image links are stored in "post_content" in the wp_posts table. You can use the similar code above to update image links.

Highlighted by liishygo

  • wp_options: Besides the "siteurl" and "home" items mentioned above, there are other option_value which also need revision, such as "upload path", and some plugin items (depends on what you've installed, such as widgets, stats, DMSGuestbook, sitemap, etc.)
  • Do a FULL database search for any items left. MAKE SURE you know what you are changing. and go through each item for possible improper replacement.
  • Highlighted by liishygo