Updated: 21 JAN 2026
Local WordPress site redirects to production domain after login. This happens if home and siteurl in the database are overwritten with the production URL.
Navigate to the config file at app/public/wp-config.php
Above the /* That's all, stop editing! */ comment, add the following lines:
define('WP_HOME', 'http://localhost:10123');
define('WP_SITEURL', 'http://localhost:10123');
This stops redirects instantly and allows you to log in. Afterwards, you will need to fix the database manually or use a plugin (like Better Search & Replace) to swap your production URL with your localhost URL.
wp_optionshomesiteurlFor example:
http://localhost:10123
wp option update home 'http://localhost:10123'
wp option update siteurl 'http://localhost:10123'
WP_HOME / WP_SITEURL from wp-config.phpindex.phpwp-config.phpwp_optionsNote: wp-config.php is loaded before WordPress reads the database.
By default, WordPress uses stored options:
home → wp_options.homesiteurl → wp_options.siteurlThese values control:
wp-config.php Overrides the DatabaseThe wp-config.php file can short circuit the process of loading from the database. When you define:
define('WP_HOME', 'http://localhost:10123');
define('WP_SITEURL', 'http://localhost:10123');
WordPress:
home / siteurl from the databaseNo database writes occur. This is a runtime override only.
wp-config.phpwp_options)Higher levels always override lower ones.
wp-config.php does not sync or update optionswp-config.php = execution-time truth