You had developed a WordPress site in a folder on your hosting account. Let’s say it was www.yourdomain.com/site/. Then it’s ready to be published and you are changing wordpress address to point to the root domain, to yourdomain.com. You copy your index.php (and .htaccess) to the root, changing path to your /site/ folder. And you changed the path to your site in Admin / Settings, as described in WordPres Codex. But what if you put a wrong address in Admin?
Like instead of modifying Site address (URL) you deleted /site/ from WordPress address (URL). You will not be able to enter admin anymore. You may edit then your database in phpMyAdmin to set back correct pathes, but the easiest way I found to deal with it, is to disable .htaccess files in root and /site/ folders, then to open /site/wp-login.php file in your editor, like notepad. Find on top of the page:
require( dirname(__FILE__) . '/wp-load.php' );
And add following lines to fix the settings:
//FIXME: remove these lines once database updated update_option('siteurl', 'http://www.domain.com/site' ); update_option('home', 'http://www.domain.com/site' );
Go to wp admin login page /site/wp-login.php and reload. You will have your login working back to normal. And you can put back .htaccess and you should delete database fix code from /site/wp-login.php. Then change the correct path in wp admin / settings. WordPress address (URL) is where your wordpress installation is stored and it may look like www.yourdomain.com/site. The second input below, Site address (URL), should be pointed to your site root, Site address (URL) – yourdomain.com. No slashes are needed at the end of URL.