I’m currently migrating from test to live site, and vice versa, by doing database find and replace for the URL. Some things occasionally slip past.
After uploading the database to the live site, everything seemed to work fine. However, I noticed today that the link from the site title had an extra subfolder attached to it. So instead of showing http://domain.com, I was getting http://domain.com/folder. The link still worked, but it seemed to be redirecting to the wrong place. Instead of domain.com, I was getting http://www.domain.com.
I suspected that this was because I did use a subfolder for my test site and probably forgot to change a database value. Poking around in header.php revealed the answer. The
home_url() function gets the option value home from the wp_options table in the database. Sure enough, this value had only been partially updated during my search and replace operations. Fixing this fixed the extra www in the domain name and got the link to point to the right place.