أهم النقاط
- WordPress stores two addresses: the WordPress Address and the Site Address.
- A wrong URL can lock you out — wp-config.php overrides fix it.
- Run a search-and-replace afterwards to update links inside content.
Option 1: Settings → General
- Log in to wp-admin and open Settings → General.
- Update WordPress Address (URL) and Site Address (URL) — for example from
http://tohttps://. - Click Save Changes. You’ll be logged out and can log in at the new address.
- Dashboard
- Posts
- Media
- Pages
- Appearance
- Plugins
- Users
- Tools
- Settings
- General1
- Reading
- Permalinks
General
Save ChangesOption 2: wp-config.php (when locked out)
Add these lines above /* That's all, stop editing! */:
define( 'WP_HOME', 'https://example.com' );
define( 'WP_SITEURL', 'https://example.com' );
Update links in your content
Old URLs remain inside posts and settings. Replace them with WP-CLI (take a backup first):
wp search-replace 'http://old-domain.com' 'https://example.com' --skip-columns=guid
Finish up
Clear caches, check for mixed-content warnings, and redirect the old address with 301s.
الأسئلة الشائعة
I changed the URL and now I can't log in.
Define WP_HOME and WP_SITEURL in wp-config.php with the correct address, then log in and correct Settings → General.
Do I need redirects after changing domain?
Yes. Add 301 redirects from the old domain to the new one so visitors and search engines follow.