2

This has happened on a number of occasions now where I move my site from Localhost to Live environment and the theme settings such as the logo, and other settings are not copied with it, so I am almost have to rebuild the site twice sometimes.

Responsive is one example where this is happening as well as numerous other themes I move from Localhost to Live environment.

Is there something I am missing when move the DB over? Perhaps another settings file?

Many thanks

1

Since I found this script, I have used it for every single move I make from Localhost to Live or vice versa.

It's incredibly simple to use and has worked every time.

https://github.com/interconnectit/Search-Replace-DB (Review: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ )

From their site:

You must use a safe search and replace method that preserves the integrity of the serialized string lengths. A simple find and replace of a dump file for http://localhost to, for example, http://examplesite.com is problematic because the length of the string changes but the indexes for the serialized strings does not. Consequently settings are lost and widgets disappear.

0

Most of the the main functionality of a theme is specified in the functions.php. And the responsive thing is defined generally into the style.css.

But if you are using any plugin, then there can be many things that are done by them. Even a specification in functions.php can be overridden by a plugin hook, or vice versa. So copying a complete site isn't just the theme. You have to:

  • copy the theme folder for the theme
  • copy the plugins folder for the plugins
  • copy the uploads folder for the files you've uploaded with the WordPress media uploader
  • copy the database for the website settings

Let's talk about business:

I follow an easy process taught by my colleague and teacher Ms. Tahmina Aktar. The process is:


From localhost to web server migration

  • Step 1a: In your localhost, find your project folder, not just the theme (in the case of WAMP, it's C:\\wamp\www\my_project)
  • Step 1b: Compress it into .zip archive (NOT in .rar or .ace etc.) - so it'd be my_project.zip.
  • Step 1c: Browse the http://localhost/phpmyadmin in browser and "Export" all the tables of your database. (Suppose that's the my_project.sql)

  • Step 2a: Go to the cPanel of your site: http://www.mysite.com/cpanel and open the "File manager".

  • Step 2b: "Upload" the my_project.zip file into the public_html folder and "Extract" it (so that it'd be my_project folder)
  • Step 2c: Open the folder, "Select all" and "Move" to just one level up (from /public_html/my_project to /public_html/), and then delete the empty my_project folder now - it has no need.

So, your project is up - completely. You just have to upload the db and configure the site to the db. But I hope you can get that, the sql file you exported from the localhost holds all the URL for your local PC. So you have to change 'em to server-specific.

So now, Open the my_project.sql file into a NotePad++ (Because NotePad++ won't make your system lazy or idle even if the db is huge)
Now press Ctrl + F to "Find", and on the text box, type: "http://localhost/mywebsite" and then click on the "Replace" tab, and type your server URL, like: "http://www.example.com".
Now find and replace individually or you can "Find" and "Replace all".
And then Save the file as my_project-server.sql.

NOTE: Remember the Forward Slash (/) at the end of the URL. If you typed http://localhost/mywebsite/ in find box, then of course type http://www.example.com/ in replace box. Otherwise the file structure can be broken, like: examplewp-content/themes/... or example//wp-content/themes/....

Now go for the final steps:

  • Step 3a: Open the "MySQL databases" in the cPanel. Create a database, then Add a User and set a strong password for the user, and then Specify the db to the User, and give all the privileges except the "Drop". (Must copy all the 3 info - db_name, user_name, and password into a notepad file)
  • Step 3b: Open the "PHPmyAdmin" in the cPanel. Find the database you just created on the left and click on it. Then "Import" the sql file you've saved later (in our case the my_project_server.sql).

So, the full & final step:

  • Final Step: From the File Manager, under public_html/, Open the wp-config.php into Editor/Code Editor mode, and change the following lines into:

    /** The name of the database for WordPress */
    define('DB_NAME', 'database_name_here');

    /** MySQL database username */
    define('DB_USER', 'database_user_name_here');

    /** MySQL database password */
    define('DB_PASSWORD', 'database_password_here');

Save the file and Browse your site as you've seen in localhost. :)

  • 1
    Thanks for the lengthy repsonse Mayeenul. This is the procedure I have always followed up it seems there is a problem sometimes with the Find And Replace in Notepad or Sublime. Here's a good article I have found on the subject about to try. wp.smashingmagazine.com/2013/04/08/moving-wordpress-website interconnectit.com/products/… – SixfootJames Aug 17 '13 at 16:16
  • Thanks. Anyways, following the warning, I never faced any problem further. – Mayeenul Islam Aug 17 '13 at 17:08
  • 1
    That script works like a bomb! So if you ever do find you have problems, follow the Smashing Mag instructions ;) – SixfootJames Aug 17 '13 at 17:15
0

I just lost all my theme settings when transferring from localhost to server. Then I discovered in my Appearance | Theme Settings an option to Import/Export code. I think you can use this to transfer settings from within the Theme options panel. I didn't try it cos I had already set everything up again. But might be handy for another transfer installation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.