Migrating wordpress from root to subdirectory on webhost!
Posted by Madhurie Singh on September 7, 2009
Tonight I will make a subdirectory for wordpress files to keep the root directory clean.
My root i.e. /public_html has all wp_ files that were created after SimpleScripts installed wordpress. Then other files were added after I imported wordpress.date.xml file through my wordpress site admin page.
I am creating a subdirectory say ONLY4KIDS where all my wordpress files will be moved.
I go to my CPanel and make a new directory under public_html. I name it as Only4kids.
Then I select all files except index.php and .htaccess files and move them into subdirectory Only4Kids.
The subdirectory is created.
Now I need to change the link address from http://www.madhuriesingh.com to http://www.madhuriesingh.com/Only4kids throughout my database.
For that I Click phpmyadmin in CPanel. Then I click the database connected with this wordpress. In my case it is madhurie_wrd01.
I then select all the tables preceding with wp_ .
Then I click EXPORT button on top. An sql file containing all my database details and content is downloaded to my laptop. This file is madhurie_wrd01.SQL
Now I open this SQL file in an editor and find all http://www.madhuriesingh.com with http://www.madhuriesingh.com/only4kids.
I save this sql file.
Before I upload it back to the database, I select all the tables and drop them.
Now I click IMPORT and select the updated SQL file madhurie_wrd01.SQL
So now all places where the reference to http://www.madhuriesingh.com are changed to http://www.madhuriesingh.com/only4kids
Now I need to change the index.php file line 17. The index.php file should be in the root directory where I change this line 17.
I change line 17 ie require(‘./wp-blog-header.php’); to require(‘.only4kids/wp-blog-header.php’);
But I get this error message when I load my site http://www.madhuriesingh.com
Warning: require(.only4kid/wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in /home8/madhurie/public_html/index.php on line 17
Fatal error: require() [function.require]: Failed opening required ‘.only4kid/wp-blog-header.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home8/madhurie/public_html/index.php on line 17
Lemme try to change the path in settings on the wordpress admin page.
OOPS 😦 !!!!
I am getting same error message here too !!!!!!!!!!!!!!!
Ok lemme guess, maybe the path has some minor error.
I will rewrite line 17 of index.php with a front slash before the subdirectory only4kids
require(‘.only4kids/wp-blog-header.php’); to require(‘./only4kids/wp-blog-header.php’);
I save the index.php file and load my site again.
YIPPPPPYYYY it works!
There is my baby .
reference
Giving WordPress its own directory while leaving your blog in the root directory
This entry was posted on September 7, 2009 at 7:40 pm and is filed under Migrating Wordpress Blog. Tagged: madhuriesingh, migrate, migrating, public_html, root, subdirectory, webhost, website, wordpress. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
WORDPRESSMIGRATION said
WORDPRESS MIGRATION