When you cannot reach the admin.
WHEN YOU NEED THIS
After a migration, where the site redirects to the old domain After changing the site address incorrectly and locking yourself out After moving between http and https
THE VALUES
In wp_options, the rows named siteurl and home.
Both should be the full https address of the site, with no trailing slash.
CHANGING THEM
In phpMyAdmin, browse wp_options, find those two rows, and edit each.
Back up the table first.
THE SAFER METHOD
Add to wp-config.php:
define('WP_HOME','https://yourdomain.com');
define('WP_SITEURL','https://yourdomain.com');These override the database without changing it, which means you can reach the admin and correct things properly.
Remove them once the database values are right.
AFTERWARDS
Clear all caches, including any caching plugin and Cloudflare.
Re-save permalinks.
WHAT THIS DOES NOT FIX
Content containing the old URL. That needs a search and replace with a serialisation-aware tool.