Creating Multiple subdirectories wordpress installation in one single database one domain.
Posted by singhmadhuri on September 12, 2009
I am gonna try creating multiple wordpress installations as I have three wordpress blogs that I want to publish in one domain.
I initially thought of trying different database for different installations but then I realised I will have lots of back related work in future!
Also I know my target readers will be nearly the same like minded people who are like me and want all that I seem to be writing about.
So keeping all related data in one database makes sense provided I keep different tables for different wordpress installations.
Now I have done it for my four blogs, ofcourse only the database and wordpress installation part till today.:) But that is an achievement.
I encountered 500 internal server error, then 404 page not found and multiple redirection to a url as errors
. But I managed to solve but the internal sever error. See my next post for the 500 internal server error solution.
So to start with when I have three blogs which I want to install in one domain, I must have a way to redirect people to each one of them seprately, right?
So it makes sense that I create a homepage where I will have all the links to my several other blogs.
So for that homepage also I created a separate wordpress installation. I name it homepage obviously.
Since when ever someone types in my domain url i.e. www.madhuriesingh.com, I want it to goto the homepage.
So I create a subdirectory in the root /public_html a subdirectory called “Homepage” and install wordpress in it through the Simple Scripts. All the files are now under one subdirectory call /public_html/Homepage .
Now I make a temporary directory in root directory, and name it “Tempdir”. so I have public_html/Tempdir
Again I select the “Homepage” directory, and copy it into “Tempdir”.
Then I rename this copied directory which has same name as “Homepage” as my new Blog name i.e. “OnlyForKids”
Now I move this subdirectory from “Tempdir” to my root directory /public_html/OnlyForKids
So now under root directory I have three subdirectories
/public_html/HomePage
/public_html/OnlyForKids
/public_html/Tempdir
I delete “Tempdir” .
Now I type www.madhuriesingh.com/homepage .
I am taken to the page where wordpress wants me to enter the Blog Name and my email id .
After I enter the details, a login id and password is generated by wordpress. I copy the password and login the admin page of my blog.
The first thing I do is change the password in my profile page to a more memorable password.
I repeat the same procedure for my other blog and type www.madhuriesingh.com/OnlyForKids.
Again I get new login and new password for the second blog.
I change the password and I own two different blogs under one domain name but a single database.
Now I need to change the URL such that, even when I type www.madhuriesingh.com I am actually redirected to the subdirectory URL www.madhuriesingh.com/homepage !:)
So to enable this, I first goto the admin page of my first blog, HomePage.
I select the settings page.
Here I leave the first URL, i.e. WordPress Blog URL as it is to www.madhuriesingh.com/homepage
but I change the second line i.e Blog URL as typed by others to www.madhuriesingh.com
I save this setting.
Now I go back to the cPanel of my webhost.
Here I locate the index.php file under the subdirectory HomePage.
I COPY (not move) the index.php file from subdirectory HomePage to the root directory /public_html
Now I open the index.php file in any editor.
I goto the line 17 and change the call
require(‘./wp-blog-header.php’); to require(‘./HomePage/wp-blog-header.php’);
I save this index.php file and close it.
Now I type in browser www.madhuriesingh.com
I am taken to the url www.madhuriesingh.com/HomePage directly !
yippppppppyyyyyyy I have done it again !:)

sumitjangir871991 said
Really Informative………………………………………
Nate said
Well you kind of did what I want to do, but my goal is to create a replica of my site into a subfolder so I can change my layout, plugins, images etc before I take it live. So I want to basically copy by database, change the files to read http://www.example.com/testsite, and access the admin to make changes. I plan to simply copy the wp-content file into the root once the changes are made and instantly have a new layout and look. Any easy suggestions on how to do this?
web007 said
thanks for your blog.. it’s helpful for me..