What is a Site URL in WordPress?
The Site URL in WordPress is the public web address your visitors use to reach your website. It shows where the homepage of your site is located, and every link on your site uses this address as the base.
What Is the Site URL Used For?
The Site URL is required for WordPress to generate correct links to your pages, posts, and assets. It is the main URL visitors interact with when accessing your site. For most users, the Site URL matches the domain name. For example, if your domain is example.com, the Site URL is typically https://example.com.
Site URL vs WordPress Address
The Site URL is different from the WordPress Address. The WordPress Address points to the folder holding your WordPress files. The Site URL points to the web address where visitors see your site.
For example, if you put WordPress in a subdirectory:
– WordPress Address: https://example.com/wp
– Site URL: https://example.com
This setup is common when you want your core files to be separate from your main site address.
Where Is the Site URL Set?
You can set or change the Site URL from your WordPress dashboard under Settings > General. You will see two boxes:
– WordPress Address (URL)
– Site Address (URL) — also called Site URL
Changing one or both values allows you to adjust where WordPress or your site content is served.
Common Uses and Scenarios
- Changing Domains: When moving your site from one domain to another, you need to update the Site URL to reflect the new domain.
- HTTPS Migration: Switching your site address from http to https for secure connections also requires updating the Site URL.
- Moving Folders: If your WordPress files move to a new folder, you adjust the WordPress Address, but you may keep your site URL the same if visitors should still see the main domain.
- Subdirectory to Root: If you install WordPress in a subdirectory but want the site on the main domain, you keep the Site URL as https://example.com and set the WordPress Address to the subfolder.
How to Change the Site URL
You can change the Site URL in three main ways:
Dashboard Method:
Go to Settings > General and enter your new Site URL.
wp-config.php File:
Add these lines if you want to set the URLs in the configuration file:
php
define('WP_HOME', 'https://example.com');
define('WP_SITEURL', 'https://example.com/wp');
In this example, WP_HOME sets the Site URL, and WP_SITEURL sets the WordPress Address.
Database Query:
You can change the values directly in your database with SQL:
sql
UPDATE wp_options SET option_value = ‘https://example.com’ WHERE option_name = ‘siteurl’ OR option_name = ‘home’;
Use this method only if you know how to use phpMyAdmin or another database tool.
Impact of Changing the Site URL
Changing the Site URL will affect all links on your website. Existing bookmarks and search engine listings may lead to broken pages if you do not forward old URLs. This setting is often updated when moving sites to a new domain or folder, or when changing your URL structure to use HTTPS.
If you move your site and do not update both addresses correctly, visitors may see errors, such as redirection loops or broken pages.
Troubleshooting Site URL Problems
Common issues when changing the Site URL include:
– “Too many redirects” errors if both addresses do not match the site’s actual location
– Broken links if internal URLs are not updated to use the new Site URL
– Lost access to the admin dashboard if the address is set incorrectly
To fix, double-check both addresses and update all references in your database, plugins, and themes.
Good Practices
- Always include https:// and do not use a slash at the end of the URL when setting the Site URL
- After making changes, test your site to make sure pages and links work as expected
- Back up your site and database before editing these settings
Examples
Subdirectory Example
Files are in https://example.com/wp and visitors see https://example.com
Site URL: https://example.com
WordPress Address: https://example.com/wp
Domain Change Example
You change from oldsite.com to newsite.com
Both Site URL and WordPress Address become https://newsite.com
Community Tips
Users often discuss how changing the Site URL can create broken links or SEO problems if not handled carefully. The usual advice is to:
– Update both addresses where needed
– Check for any plugin or theme settings that store the old domain
– Search and replace links in the database if you have many internal references
Always test your site in a browser after changing the Site URL to confirm it loads as expected.