Title: Problem restoring localhost site
Last modified: August 24, 2016

---

# Problem restoring localhost site

 *  [Inkers92](https://wordpress.org/support/users/inkers92/)
 * (@inkers92)
 * [11 years ago](https://wordpress.org/support/topic/problem-restoring-localhost-site/)
 * Hi all,
    I was transferring site from localhost to web host. I kept getting a
   database connection error even though I checked and double checked config etc.
   Anyway, that is now the least of my worries. I decided to start from scratch 
   in case DB was corrupted in transfer or something. I deleted all files from my
   folder and replaced them with copies of originals I had kept before trying the
   transfer. I changed the urls back to localhost/sitename in the database. My problem
   now is that I am getting page not found errors. I have managed to login via localhost/
   sitename/wp-login but the whole dashboard shows as a list view with no styling
   at all. If I try to access the localhost/sitename/wp-admin I get a page not found
   error and the url reads localhost/sitename/localhost/sitename/wp-admin etc. This
   makes me think it is a directory structure issue. Annoyed at myself for making
   quick decisions and completely stumped. Any help would be greatly appreciated.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Justin Greer](https://wordpress.org/support/users/justingreerbbi/)
 * (@justingreerbbi)
 * [11 years ago](https://wordpress.org/support/topic/problem-restoring-localhost-site/#post-6120619)
 * Hi,
 * Looks like you may have not changed all your site url references in the DB all
   the way and or used a bad regex when find/replacing and you corrupted the site
   url buy doubling it up. Try [https://codex.wordpress.org/Changing_The_Site_URL](https://codex.wordpress.org/Changing_The_Site_URL).
   Use the define method.
 *     ```
       define('WP_HOME','http://example.com');
       define('WP_SITEURL','http://example.com');
       ```
   
 *  Thread Starter [Inkers92](https://wordpress.org/support/users/inkers92/)
 * (@inkers92)
 * [11 years ago](https://wordpress.org/support/topic/problem-restoring-localhost-site/#post-6120625)
 * Hey Justin,
    Thanks for that. I figured out the error. When I entered the url
   under settings I used localhost/sitename. Now I have changed it to [http://localhost/sitename](http://localhost/sitename)
   and everything seems to have returned to normal.. for now. Hopefully everything
   is ok.. now I just have to figure out what was causing the database connection
   error! BTW – if anyone could point me to the absolute best step by step of migrating
   site from localhost to hosting, I would be grateful.
 *  [Justin Greer](https://wordpress.org/support/users/justingreerbbi/)
 * (@justingreerbbi)
 * [11 years ago](https://wordpress.org/support/topic/problem-restoring-localhost-site/#post-6120627)
 * Your Welcome!
 * The process is going to be the same as any migration walkthrough. Here is some
   article that I have been around for some time:
 * – [https://codex.wordpress.org/Moving_WordPress](https://codex.wordpress.org/Moving_WordPress)
 * – [http://premium.wpmudev.org/blog/guide-to-migrating-localhost-wordpress-to-live-site/](http://premium.wpmudev.org/blog/guide-to-migrating-localhost-wordpress-to-live-site/)
 * – [http://www.wpbeginner.com/wp-tutorials/how-to-move-wordpress-from-local-server-to-live-site/](http://www.wpbeginner.com/wp-tutorials/how-to-move-wordpress-from-local-server-to-live-site/)
 *  Thread Starter [Inkers92](https://wordpress.org/support/users/inkers92/)
 * (@inkers92)
 * [11 years ago](https://wordpress.org/support/topic/problem-restoring-localhost-site/#post-6120672)
 * Thanks, it was my db host that was causing the connection error. Next issue is
   that when it connects I have code showing as html before the header that doesn’t
   show on localhost. Weird.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Problem restoring localhost site’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [Inkers92](https://wordpress.org/support/users/inkers92/)
 * Last activity: [11 years ago](https://wordpress.org/support/topic/problem-restoring-localhost-site/#post-6120672)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
