Changing The Site URL

In the Settings->General screen in a single site installation of wordpress, there are two field named “wordpress address (URL) and the web site address (URL). They are important because they control the wordpress that your site is located. They control the display of the URL in the management section of your page, as well as the front-end, and all use the wordpress code.

The site address (URL) is set to the desired address in their browser type to your wordpress blog.
“WordPress address (URL) to set the address where your wordpress core files reside.
Note: These two settings should include the http:// part and should not have a trailing slash “/”.

At the same time every time, it was felt that the need to manually change (or repair). Usually this happens, change one or both of them, their site does not work properly. This allows users to easily find ways to solve the problem. This article will tell you how to change these settings directly.

Additional information is introduced here, you are moving wordpress from one site to another, it will also need to change the URL of the web site. You should not attempt to use this additional information if you will only be able to attempt to correct the damaged site.

Changing the Site URL

There are four simple ways to change the URL of the web site manually. Any of these methods will work and perform the same function.

In the following notes that ‘WP families’ and ‘home’, please refer to the web site address (URL) or you want what type of visitor in their browser. The SITEURL ‘WP’ and ‘siteurl’ please refer to the “wordpress address (URL)” or “address where your wordpress core files reside.

Edit wp-config.php

It is possible to manually set the site URL in the config.php file WP.

These two lines are added to your WP-config.php with the” is the correct position, your site

is defined (‘SWP home,’);
definition (‘SWP of’); SITEURL”,
this is not necessarily the best solution, it just hardcoding the values into the site itself. You will not be able to edit them in the General Settings page, then use this method.

Edit functions.php

If you have access to the site via FTP, this method will help you to quickly obtain a site back up and running, if you change these values are not correct.

1. The FTP site, and obtain a copy of the theme’s functions.php file. You’re going to edit it in a simple text editor, and upload it to the site.

2. Add these two lines in the file. Immediately after the initial “<?php” line in

the update option (the siteurl’, ‘’;
update option (the ‘home’, ‘’);
use your own URL instead of the is obvious.

3. Upload files to your web site, at the same location. Filezilla offers a convenient “Edit” feature to complete all of these rapidly; if you can use the system to do so.

4. Load log in or admin page several times. The web site should come back up.

Important! Do not use these lines are the functions.php file. To delete these files, the web site is up and running.

Note: If your theme does not have a functions.php file to create a new text editor. Add the php tags and the two lines using your own URL, instead of

update option,”,’ siteurl’);
update option (the ‘home’, ‘’);
upload to your theme directory. Delete Row or delete the file, the web site is up and running.


Here are some of the extra steps, you can transfer a LAN-based wordpress website into an externally accessible sites, but also allows editing of the wordpress web site from the internal LAN.

Two of the most important keys in the router/firewall modifications and wait 10 minutes after the change in the end

-use ssh to log in to your server (nm is a server-installed text editor)
– in the nano /var/log www/book/wp-content/themes/twentyeleven/functions.php
– just add a row to the <?php

update option,”,’ siteurl’);
update option (the ‘home’, ‘’);
– refresh your web browser using your external site url
– USD nano /var/log www/book/wp-content/themes/twentyeleven/functions.php
– Delete those lines. You have just added (or comment)
– Access your router (the pfsense, other routers should have similar settings, look for/against)
– added to the Firewall/NAT table, a line is such a

wide area network/TCP/IP port/LAN, the server’s IP/80 –
added to the firewall/Rules form a line like this

* TCP//port/LAN, the server IP/Port /*
– uncheck this check box, the system/Advanced/Network Address Translation/Disable NAT thought

disabled automatically creates a NAT redirection rules for access to your public IP address, on your internal network. Note: You can only think about port forwarding” type of goods and does not work for large range > 500 ports. ”
And then to do something, for ten minutes, when you come back to look at the external url by lan browser of the page up correctly.

Relocate method

WordPress supports the auto-positioning method is intended to be a quick help for a site’s work when a site migration from one server to another.

The Code function
, the re-positioning is defined as the real WP-config.php (see next section), the following code in the wp login, php will take action: if (as defined in the function”)&& relocation Relocation) {// mobile flag set
if (isset function $_SERVER [000 paths”)&& (in server [000 paths” ]! = $_SERVER ”PHP_self”])
$_SERVER ”PHP_self”] = .str_replace function $_SERVER [‘path”, ”’ $_SERVER PHP_self”);

in the url = dirname (set in the url scheme (the ‘http://’. $_server [000] HTTP host. [ $_server’ PHP_Self”)
($); if the url _ ! = ‘siteurl’ option (())
update (”, siteurl url);

1. Edit the wp-config.php file.

2. The “definition” of the statement (the comment line, said: “All of this, stop editing! “), Insert a new line, and type: definition (the ‘Transfer’, true);

3. Save your WP-config.php file.

4. Open a web browser and manually point it to the wp-Login.php on the new server. For example, if your site is in the, type, and then in the address bar of your browser.

5. The normal login.

6. In your web browser’s address bar to verify that you are sure you are logged in to the correct server. If this is the case, then in the management of the back-end, navigate to Settings > General and verify that the two addresses are set correctly. Remember to save your changes.

7. Once you have fixed the problem, please edit the wp-config.php), or completely remove the line has been added (delete entire rows), comment it out (//), or change the true value, if you think it is possible you will re-positioning.

Note: When you reposition the flag is set to true, then the URL of the web site will be updated automatically, regardless of whether you use path to access the log-in screen. This will be the admin section is up and running a new URL, but it will not correct any other part of the setting. Those that you still need to be manually changed.

Important! While the re-positioning in your WP-config.php file is not safe, because it allows an attacker can change your site’s URL for anything they want in some configurations. Be sure to re-locate the WP-config.php, you are done.

Changing the URL directly in the database

If you know how to access the phpmyadmin on your host, then you can edit these values directly to get you up and running again.

  1.  To back up your database and save a copy to your site.
  2. Log in to phpmyadmin.
  3. Click on the link to your database.
  4. A list of your database will appear. Select one of your wordpress database.
  5. All tables in the database will appear on the screen.
  6. From the list, look for the wp option. Note: The table prefix on the wp might be different, if you changed it at the time of installation.
  7. Click on the small icon displayed in the Browse.
  8. A screen will open with a list of fields within the WP options table.
  9. According to the field name, scroll down to find the siteurl.
  10. Click the edit field icon is usually located on the left side of the line.
  11. The Edit field window will appear.
  12. In the input box, carefully Adding URL Information to a new address.
  13. Verify that this is correct, then click Go to save the information.
  14. You should go back to your WP options table.
  15. View Home Page field in the table and click the edit field. Please note that there is a multi-page form wp option. Look for the > symbol on the page.
  16. In the input box, carefully Adding URL Information to a new address.
  17. Verify that this is correct, then click Go to save the information.

Moving Sites

When you move sites from one location to another location, it is sometimes necessary to manually modify the data in the database, so that the new site URL information is correctly identified. There are many tools to assist in this existence, and these should be used, and cannot be modified manually.

This is presented here for information only. This data may be incomplete or inaccurate.

You should read the mobile wordpress article first, if you attempt to move wordpress from one system to another.

Altering Table Prefixes

Like many wordpress administrator, you may be running a few wordpress facilities close to one of the database using various wp-config.php to hack. Many of these hackers need to dynamically set the table prefix, if doing so will change the way your table prefix, you must update several entries in the prefix, the usermeta table.

As in the previous chapter, please keep in mind that SQL change is permanent, so you should back up your database:

If you change the table prefix of a site, so please keep in mind that the change table prefix in the usermeta table. This will allow the new web site in order to correctly identify the user permissions from the old site.

Newprefix_usermeta ‘Update’ settings’ in the mi_key = replace (‘yuan mi_key’ the oldprefix newprefix_’ ‘_’);

Changing Template Files

In your wordpress theme, open each template file and search for any reference to manually enter your old domain name, and replace it with a new one. To find a particular hand-coded link, you may enter a different template files, such as the sidebar..php the php header and footer.

WordPress uses Templates tab is called the bloginfo() to automatically generate your site’s address from the information entered into your Admin > Settings > General > panel. In the Tag in your template files will not be modified.

Changing the Config file

You will need to update your wordpress configuration file, if your database has moved or changed in some way.

  1.  You only need to modify the configuration file, if
  2. your database has been transferred to another server, but is not running on your local computer,
  3. you can rename your database
  4. , you have to change the database user name
  5. “‘backup your WP-config.php file. “
  6. Open wp-config.php file in a text editor.
  7. To view its contents. In particular, you are looking for a host of entries in the database.
  8. To save the file.
  9. At this point, your wordpress blog should work properly.

Verify the Profile

  1.  In your admin panel go to Settings > General. Here, you will verify the changes you made, change the above URL is correct.
  2. Verify that the reference to your wordpress address (URL) contains a new address.
  3. Verify that the references in your site address (URL) contains a new address.
  4. If your changes, click Save Changes.

Changing the .htaccess file

The information in your Management > Settings > General panel, you will need to update your .htaccess file (if you are using the permalinks or any rewrites or redirects.

  1.  Back up your .htaccess file. This is not a recommendation, it is a requirement.
  2. Open the .htaccess file in a text editor.
  3. A review of its content, look for any custom rewrite or redirect you to enter. Copy them to a text file, in order to ensure safety.
    Close the file.
  4. Follow the instructions on the permalinks subpanel to update your permalinks for .htaccess files.
    Open a new .htaccess files, and view your custom rewrite and redirect is still there. If not, please copy them from the saved file and paste it into a new .htaccess files.
  5. Any changes must be carried out in these custom rewrite and redirect to reflect the new site address.
    To save the file.
  6. Test the redirection to ensure that they are able to work properly.
  7. If you make a mistake, you can restore from backup your database from your backup and try this again. Therefore, make sure it is right the first time.

Additional items of note

There are other things you may want to change to the correct URL to the site when you move.

  1.  Photo: Picture links are stored in the back of the content of the wp-posts table. You can use similar to the above code to update the image link.
  2. Wp: in addition to the siteurl” and “home” as mentioned above, there are a number of other options, it also needs to be changed,
  3. such as the upload path”, and the number of plug-in item (depending on whether you have installed, such as a small part, statistics, dmsguestbook, site map, etc.)
    to fix the widgets that contain outdated URL-s, you can edit them, the dashboard/look/small tools.
  4. Do a complete database search for any item on the left hand side. Make sure you know what you are changing, and through each of the possible improper replacement.
  5. If you are running a network/has more than one site, you will need to replace the example in the URL database. They are stored in more than one table, including each one of the website (blog). Take care of your replacement, make sure you know the meaning of the fields, and then change it. Please refer to the important GUID note below for an example of what not to change.
  6. Please note that if you find that your old URL database option in the form of the “Dashboard” of incoming links, you can choose to ignore or delete it. This is because not using WP 3.8.
  7. How to connect your wordpress blog: Moving to a new area – use the export/import feature to move a blog to a new domain
  8. important note the GUID
  9. , do the above and changing the URL directly in the database, you will have instance URL is located in the heart of the “guid” column
  10. of the table in the WP posts.
  11. It is very important that you cannot change the contents of this field.
  12. “On Behalf Of” the GUID Globally Unique Identifier”. This is one of the areas with the aim of maintaining an identifier, the position of a) is unique in the entire space and time, and b), at any given time will not change. The GUID field is primarily used for creating a wordpress feeds.
  13. When a feed reader read the feed, it uses the GUID field lets you know if there is a specific project. This is in a variety of ways, but the most commonly used method is to simply save a list of GUID, it has been shown, and “Mark As Read” or similar.
  14. Therefore, change the GUID, it means that many of the feedreaders suddenly will display your content on the user’s card reader, as if it were a new content that can be annoying for your users.
  15. In order to enable the GUID field set to “global” is unique in that it is a widely accepted convention in the URL or some representative URL is used. Therefore, if you have your own so you are the only one use of the and therefore it is unique to you and your site. This is why wordpress use permanent link, or some form of documentation, the GUID.
  16. However, the second part is that the GUID must never be changed. Even if you switch the domain for the post, remains the same, even if it is in a new location. Feed readers is transferred to your new feeds when you change the URL should still know that they already know some of your posts, as a result, the GUID must remain unchanged.
  17. Never, ever, to make changes to its content GUID column, and in any case.
  18. Note: If the default upload folder needs to be changed to a different location, then any of the media URL will need to change the content of the posts table. For example, if the default upload folder is changing, from the wp-content/upload images:
  19. Update wp position post content = replacement (post content, thousands of’,’’);