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.
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.
Log into your WordPress Administrative Dashboard using your old URL.
Hover over Settings and click on the General menu option.
Under the General Settings section, enter the new URL in the WordPress Address (URL) and Site Address (URL) fields.
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.
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.
Click on the File Manager icon.
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.
Alternatively you can simply left-click on the wp-config.php file and click on Edit from the toolbar above.
Read the warning pop-up message that displays and then simply click on the Edit button.
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 URL you will use. The following screenshot shows you how the code should be appear within the existing code (after you add it).
Click the Save Changes button from the top right.
Click the Close button from the top right to close the file.
Open your favorite SSH Client and connect to the server (how to SSH with Mac) where you have moved the website files to.
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.
Run the following command to open the file for editing:
nano wp-config.php
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.
Press Ctrl + O (on Mac press Command + O), hit enter to confirm to save the changes to the named file (wp-config.php).
Finally, press Ctrl + X (on Mac press Command + X) to exit nano.
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.
Click on the phpMyAdmin icon.
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.
Click on the wp_options table.
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.
Email: | support@WebHostingHub.com | Ticket: | Submit a Support Ticket |
---|---|---|---|
Call: | 757-416-6627 | Chat: | Click To Chat Now |
We value your feedback!
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.
new! - Enter your name and email address above and we will post your feedback in the comments on this page!