Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am looking at moving my WordPress site from localhost on my mac (MAMP – htdocs directory) to online hosting that is using cPanel.

When I log into my cPanel online, I am presented with my home directory that includes the following directories:

1)  public_html
2)  www

My question is, what is the equivalent “htdocs” directory in MAMP on my localhost within cPanel online - is it public_html directory or www directory?

Like to know where I install WordPress within cPanel as well as child theme that I currently have on my mac(localhost)?

If there are any decent sites that take you through this scenario, would really appreciate any links.

Thanks.

share|improve this question

2 Answers 2

To answer your first question, in mosts hosts the www and public_html folders are the same, one just links to the other. To make things simple, start with the public_html folder. There is usually what is called a symlink between the two, pretty much like an alias or a shortcut.

Now for the second question on moving the site, perform approximately the following:

  1. Copy the entire contents of your local MAMP's htdocs directory into the public_html folder on your host, most likely using an FTP program of some sort.
  2. In cPanel, you will need to create a new database to hold your site's data. This again depends on the host and cPanel version/theme, but there is typically a database section on the home page that will let you create a new one. You will need to also create a new database user and password, and assign rights for that user to use the database you just made.
  3. Also look for phpMyAdmin in cPanel, and open in it up. On your local MAMP installation, go to http://localhost/MAMP/ and click on the phpMyAdmin link in the top menu bar. Open your database, and go to Export, click the "Go" button, and you should be left with a big huge textbox of SQL commands. Copy this entire section, go to your cPanel's phpMyAdmin, find your database, click "SQL," and paste in all of that text. Click "Go" and it will import almost all of your settings.
  4. Now you'll need to tweak a couple of settings on your cPanel's database. Find the wp_options table in phpMyAdmin, click Browse, and in the values look for anything that references the old site, like 127.0.0.1 or localhost, and change it to the proper address.
  5. Finally, you'll need to change the database settings in your wp_config.php file, which should now be in your public_html folder. Open it up and find the database name, username, and password, and update it to reflect what you have in cPanel.

That is obviously a very general set of instructions, but it is the basic path that you would need to take. There are plenty of sites detailing moving a WordPress site, but it is always very particular and will always need to be adapted to your specific situation.

Google will be your friend on this, but here's a couple to get you started:

Good luck!

share|improve this answer
    
Appreciate your help @joshua - will try it out. Thanks. –  tonsils Sep 6 '11 at 5:53
    
Just to confirm though, I am placing all files in htdocs/my.site inside public_html folder alone and not a sub folder inside public_html? Further, do I need to install Wordpress on live site or does my first step here in this comment cover this? Thanks. –  tonsils Mar 15 '12 at 15:43
    
That's correct, no subfolder needed. You shouldn't need to go through the installation process again if you are copying the files and the database as is from your current working installation. Don't forget step #5 from the answer about modifying DB access credentials in wp_config.php, as this is mostly what the installation process does. –  Joshua Mar 15 '12 at 19:44
    
Thanks again Joshua. Just wondering if I have to make any changes to the .htaccess file that resides in this directory as I still can't seem to get the site showing and this file had two entries pointing to a path I no longer have on the LIVE site? Do I need to add the path /public_html ? –  tonsils Mar 15 '12 at 21:00
    
If you can access your dashboard on the live site, then go to Settings > Permalinks and change the options to something else, then change them back. This should whip your .htaccess file into shape. If not, do try copying over the old one to the live site. –  Joshua Mar 16 '12 at 0:34

Post above covers it, but I find that the WP database still has remnants of the local address scattered throughout. I find that exporting a copy of your local database and doing a simple find and replace with TextWrangler or editor of choice is the fastest and cleanest.

  1. Export a copy of the database with phpmyadmin
  2. Open with text editor
  3. Use find and replace and clear out the old address
    • Find: localhost:8888/sitename ---> Replace with: www.yoursitename.com
  4. Using phpmyadmin in your hosts cpanel account, check off all the tables in the database and use the drop command. (this keeps the database but clears all data)
  5. Using phpmyadmin, select the import tab and upload the revised database file from your local machine.
  6. Done in 5 minutes...

!!! Don't be stupid and always make a backup copy the original database file

share|improve this answer
    
Will break serialized arrays. –  toscho Nov 8 '12 at 3:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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