Madhurie Singh . Com

How to build my own web site from my wordpress blog !

Posts Tagged ‘subdirectory’

Deciding to Install wordpress in a subdirectory/ root on webhost of my website!

Posted by Madhurie Singh on September 8, 2009

I have now installed wordpress more than 50 times 😛 !

And I realize a few very important things in deciding where to install wordpress.

A: WordPress in the Root directory i.e. /public_html

This is a good idea only for those who have intentions to work with only one blog.
If tomorrow, I wish to start a new blog, like this current blog, then I will have problems.
I will then have to either create a separate subdirectory for the second blog2 or I will have to move the blog1 first into a subdirectory and then create a new subdirectory for blog2. Now moving wordpress installation to a subdirectory later at any point is tricky always.

B: WordPress in the subdirectory right from the start under Root directory i.e. /public_html/Blog1

This is an excellent idea. Any fresher must do this to have a clean root directory and have all wordpress installation of blog1 in a subdirectory called blog1.

If tomorrow I wish to install a second wordpress blog2 in the root directory, all I have to do is create a new subdirectory under root called blog2. i.e. /public_html/blog2

Also the problem of my URL with and added subdirectory name is solved by using the facility called “Redirecting WordPress” through CPanel. So people have to type only one url everytime to reach any of my blogs. i.e.

C: WordPress installed in the root when I have only one blog, blog1. But later on I migrate the blog1 to a subdirectory under root directory called public_html. Now my final path looks like this /public_html/blog1


Posted in Migrating Wordpress Blog | Tagged: , , , , , , , , | 16 Comments »

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 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.

move all wordpress files to subdir

The subdirectory is created.
created now subdirectory for wordpress

Now I need to change the link address from to 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_ .
select all tables in original table and export

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
exporting the tables to change wordpress to subdirectory

Now I open this SQL file in an editor and find all with
I save this sql file.
change all urls to new url with subdirectory

Before I upload it back to the database, I select all the tables and drop them.
drop all tables and import the file which has updated url

Now I click IMPORT and select the updated SQL file madhurie_wrd01.SQL
import all updated tables in database

So now all places where the reference to are changed to

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

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.


There is my baby .
mysite after migrating to subdirectory


Posted in Migrating Wordpress Blog | Tagged: , , , , , , , , | 1 Comment »