×

Warning

JUser: :_load: Unable to load user with ID: 316003198

Whether you are testing your WordPress website using your temporary URL or moving your WordPress website to another directory, you will need to change your WordPress Site and Home URL. This configuration can be updated in your wp-config.php file, the WordPress database, and also through your WordPress Administrative Dashboard. You may not need to complete each method, depending on your circumstances. However, the following guide provides the steps to change your WordPress Site and Home URL via multiple methods.

Dashboard

If you are moving your WordPress website's directory location, then you can simply update the Site and Home URL in your WordPress Dashboard. Once this change is made, you will no longer be able to access the administrative dashboard, until you move the files into the new directory your URL is using. Use the steps below, only if you have not yet moved/copied the site files into the new location.

  1. WordPress Username and Password fields and Login button highlighted

    Log into your WordPress Administrative Dashboard using your old URL.

  2. WordPress Dashboard Settings menu expanded and General menu option highlighted

    Hover over Settings and click on the General menu option.

  3. General Settings WordPress Address URL and Site Address URL fields filled in with new URL are highlighted

    Under the General Settings section, enter the new URL in the WordPress Address (URL) and Site Address (URL) fields.

  4. General Settings Save Changes button highlighted

    Scroll down to the bottom of the page and click the Save Changes button.


Your changes are now saved, however, you will be redirected to the WordPress Dashboard using the new URL. This may load a 404 Not Found or 500 Internal Server error. However, once you move/copy the files to the new location, you will be able to regain access to your WordPress Administrative Dashboard using the new URL.

wp-config.php File

If you are moving your WordPress website's location, then you can simply update the wp-config.php file to use your new URL. If you have already moved the site files to the new location, follow the steps below to modify the Site and Home URL for WordPress.

cPanel File Manager

  1. cPanel login page displayed

    Log into cPanel.

  2. cPanel File Manager icon highlighted

    Click on the File Manager icon.

  3. File Manager wp-config.php file Edit menu option highlighted from right-click menu pop-up

    Navigate to the new location of your site files and find the wp-config.php file. It will be located in the document root folder of your website. Right-click on the file and select Edit from the pop-up menu.

    File Manager wp-config.php file selected and toolbar Edit button highlighted

    Alternatively you can simply left-click on the wp-config.php file and click on Edit from the toolbar above.

  4. File Manager Encoding Warning Message pop-up Edit button highlighted

    Read the warning pop-up message that displays and then simply click on the Edit button.

  5. Once the file opens, locate the beginning of the MySQL settings code, it looks similar to:

    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define('DB_NAME', 'exampl3_wp66');

    Above that code, enter the following code:

    /** Changes Site and Home URL for WordPress configuration **/
    define('WP_HOME','http://example.com/newlocation');
    define('WP_SITEURL','http://example.com/newlocation');

    wp-config.php file with new Site and Home URL entered within existing code

    Be sure to modify the highlighted portion of the code to the URL you will use. The following screenshot shows you how the code should be appear within the existing code (after you add it).

  6. File Manager Edit Save Changes button highlighted

    Click the Save Changes button from the top right.

  7. File Manager Edit Close button highlighted

    Click the Close button from the top right to close the file.

SSH

  1. Open your favorite SSH Client and connect to the server (how to SSH with Mac) where you have moved the website files to.

  2. Navigate to the website's new document root directory using the following command:

    cd /home/userna5/public_html/newlocation

    Be sure to replace the highlighted portion of that command with the actual user and new location of the WordPress files.

  3. Run the following command to open the file for editing:

    nano wp-config.php
  4. Once the file opens, locate the beginning of the MySQL settings code, it looks similar to:

    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define('DB_NAME', 'exampl3_wp66');

    Above that code, enter the following code:

    /** Changes Site and Home URL for WordPress configuration **/
    define('WP_HOME','http://example.com/newlocation');
    define('WP_SITEURL','http://example.com/newlocation');

    Be sure to modify the highlighted portion of the code to the actual URL you will use.

  5. Press Ctrl + O (on Mac press Command + O), hit enter to confirm to save the changes to the named file (wp-config.php).

  6. Finally, press Ctrl + X (on Mac press Command + X) to exit nano.

Database

If you are moving your WordPress website's location, then you can simply update the database to use your new URL. If you have already moved the site files to the new location, follow the steps below to modify the database. This will update the WordPress Site and Home URL to use the new URL for your website.

  1. cPanel login page displayed

    Log into cPanel.

  2. cPanel phpMyAdmin icon highlighted

    Click on the phpMyAdmin icon.

  3. phpMyAdmin database name highlighted

    Click on the database you are using for the website. If you do not know the name of the database, open your wp-config.php file and view the MySQL settings, to determine the name.

  4. phpMyAdmin database table highlighted

    Click on the wp_options table.

  5. wp_options table option_value for option_names siteurl and home entries highlighted

    Find siteurl and home under the option_name column. Under the option_value column, double-click next to each entry and enter the new URL you want to use for your website. Your changes will save automatically once you click out of the boxes you edit. You can simply close the window to exit out of phpMyAdmin.


Congratulations! You know now where you can modify your WordPress Site and Home URL to change the URL used for your website. For more WordPress advanced tutorials, be sure to check out our Help Center Learning Corner.

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address
Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Did you find this article helpful?

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Need More Help?

Help Center Search

Current Customers

Email: support@WebHostingHub.com Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.
}