Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP How to Build a WordPress Theme Launching a WordPress Site How to Migrate a Local WordPress Site to Live Server

Don Shipley
Don Shipley
19,488 Points

Migrate a Local WordPress Site to Live Server

For some reason my server will not configure wordpress inside a sub-folder. The site will see the database and the url will open using the site name/subfolder . If I look under the dashboard appearance editor I see the pages there. Any suggestion on how you can configure wp to read the files in a sub-folder using control panel. My root would be home/example/public_html/exampleFolder

14 Answers

Don Shipley
Don Shipley
19,488 Points

Just to let every one know what I did to make this work. Watched the videos a second time. This time I did not change the setting when creating word from wp_ to WPP. I may have had an error somewhere for I believe that wp will not work if you have an error. It still would not work with the wp-admin sign on so with the server I am using went into phpmyadmin and changed the wp_options to read my url. I then could sign in using the wp-admin and all worked.. Thank you all for your help on this and if someone else may have the same problem you may be able to help them as well

Thank you once again, Don

Don Shipley
Don Shipley
19,488 Points

I can see what the problem is need to find a way to fix it. Doing a backup when I import it into the database it just creates the tables as wp_, I upload the files along with the wp-config it creates another set of tables as wp_wpp. If I change the database in my wp-config to read $table_prefix = 'wp_wpp'; the site will display but the wp-admin will not. Only a white screen. Change it back to $table_prefix = 'wp_ the wp-admin works but the site does not read from the wp_wpp so the site does not display correctly..

Andrew Dushane
Andrew Dushane
9,264 Points

Do you have a .htaccess file in your subfolder setup according to this guide? http://codex.wordpress.org/htaccess

Don Shipley
Don Shipley
19,488 Points

Yes there is an .htaccess will read the codes you gave. Not sure what to change it to read the files. The domain name.com will not perform what is needed. Thank you for your reply

Brandon Crane
Brandon Crane
13,328 Points

I would make sure that your urls are correct in your general settings.

Wordpress Address - http://example.com/wordpress/ Site Address - http://example.com/

Also, make sure you've COPIED / PASTED your .htaccess AND index.php files from your subfolder into your root folder. Copies have to be in both directories.

Don Shipley
Don Shipley
19,488 Points

They are and just placed on my main domain for this and still the same problems. I have built a site before using underscores as my blank template and have never had the issues trying it this way. However I did not build the pages on the localhost first just changed the stylesheet to read from a custom stylesheet by placing a small code in the functions.php/ I have gone in the phpadmin and changes the wp_options to read the sites url.. If I go into the temperance and edit I can see the pages are there but the site will not read them nor does it read the read the stylesheet correctly. It must see it for the template is there and can activate it. shipmik.com is the site and was trying shipmik.com/wp_portfolio. Neither site works correctly..

Brandon Crane
Brandon Crane
13,328 Points

If you end up changing the URLS first, your site will appear to break. SO that also means you'll have to edit a line in the index.php file.

make sure you put /name of your directory in front of /wp-blog-header.php

Don Shipley
Don Shipley
19,488 Points

this is the wp-blog-header /**

  • Loads the WordPress environment and template. *
  • @package WordPress */

if ( !isset($wp_did_header) ) {

$wp_did_header = true;

require_once( dirname(__FILE__) . '/wp-load.php' );

wp();

require_once( ABSPATH . WPINC . '/template-loader.php' );

}

Brandon Crane
Brandon Crane
13,328 Points

Yeah, this one is good. It's the index.php file that needs the tweaking where it calls the wp-blog-header.php file.

Andrew Dushane
Andrew Dushane
9,264 Points

If your permalinks aren't set to default, change them to default and see if that fixes it. If so, you should be able to switch back to your custom structure and the fix will remain.

Don Shipley
Don Shipley
19,488 Points

Have changing the permalinks and that does not fix it. When I was using the sub-folder the site would only display a blank white page of death lol

Don Shipley
Don Shipley
19,488 Points

changed the .htaccess to read as one of my other sites read.

BEGIN WordPress

<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>

END WordPress

Don Shipley
Don Shipley
19,488 Points

Thank you for the link. All those on mine are correct The index.php and the wp-bload-header.php point to wp-load.php which should go to the wp-config.php if ( file_exists( ABSPATH . 'wp-config.php') ) {

/** The config file resides in ABSPATH */
require_once( ABSPATH . 'wp-config.php' );
Don Shipley
Don Shipley
19,488 Points

My wp-config.php define('DB_NAME', 'shipmik7_wpportfolio');

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

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

/** MySQL hostname */ define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */ define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */ define('DB_COLLATE', '');

define('WP_SITEURL', 'http://shipmik.com'); define('WP_HOME', 'http://shipmik.com/wordpress');

Brandon Crane
Brandon Crane
13,328 Points

is your DB username correct? Do you need to add the account prefix - i.e. 'shipmik7_USERNAME'?

Don Shipley
Don Shipley
19,488 Points

Thank you Brandon with your help. If you could answer two questions for me. Even after you built your wordpress site on a localhost do you need to rebuild the pages on wordpress for them to display: 2) Do you need to install wordpress on the live server before you import your database on phpadmin and upload your new theme?

Don Shipley
Don Shipley
19,488 Points

not for the username only for the database.. Deleted my cookies not under the sign on for wp-admin I am getting the white page of death. This could be since I changed the permalinks looking into that now...

Brandon Crane
Brandon Crane
13,328 Points

I just zip up the folder on my dev server and dump it on the live server, then edit the WP-config file so the DB information matches the empty DB and DB user on the new server, the site URL, and the directory.

Then I import the DB and it's usually done.

Brandon Crane
Brandon Crane
13,328 Points

More than happy to help you later this evening of you're still stuck!

Don Shipley
Don Shipley
19,488 Points

Thanks Brandon, I am trying something other than what is shown on the video. I went into my phpadmin created a backup from there. Uploaded the wordpress prior which I did not think needed to be done since it was installed on the localhost. Imported the database on the live server, Now I am just going to upload the file as a theme. See where that goes if it does not display the pages built on the localhost will try it without installing wordpress on the live server and uploading them the same without using the backup from the localhost wordpress and export them from phpmyadmin...

Don Shipley
Don Shipley
19,488 Points

Still doing the same thing.. once I change the premalinks it breaks the site