Title: Using different database for subdomain website
Last modified: August 30, 2016

---

# Using different database for subdomain website

 *  [patrickperte](https://wordpress.org/support/users/patrickperte/)
 * (@patrickperte)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/using-different-database-for-subdomain-website/)
 * Hey everyone, I’ve been having a problem I can’t seem to solve. I have a main
   website that I do testing with, just messing around with designing and whatnot.
   I created a few subdomains from cPanel, for different websites. One of these 
   sites I have completed and my client would like to replace his old website with
   mine. The client also uses cPanel, and so what I did was added a subdomain on
   his website, and that subdomain is set to use the database of the website I created.
   After adding a user to be able to use the database, I checked the website, and
   it seems that my original website shows up, not the one I want. So to summarize,
   the main website A has a subdomain B, with it`s own database. I saw no option
   to download subdomain B`s database, only A’s. I then went to the clients cPanel,
   created a subdomain using A’s database, and so because of that website A shows
   up, when I actually want B to show up. Could anyone explain how to download B’s
   database, seeing how it is a subdomain of A?
 * EDIT: I should add that when in cPanel, I only see A’s database in the list of
   databases (mySQL databases), not any of the other ones. I can only access B’s
   database by going into phpMyAdmin and choosing to view B’s database.

Viewing 13 replies - 1 through 13 (of 13 total)

 *  [leejosepho](https://wordpress.org/support/users/leejosepho/)
 * (@leejosepho)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/using-different-database-for-subdomain-website/#post-6319605)
 * Each site should have its own table_prefix, and you can be selective during export
   as well as when placing a table_prefix in wp-config.php. Databases are for content
   and have very little to do with how that content is displayed, however, so I 
   am a bit curious as to how someone else would be interested in having a copy 
   as well as whether you are aware of duplicate content destroying SEO rating.
 *  Thread Starter [patrickperte](https://wordpress.org/support/users/patrickperte/)
 * (@patrickperte)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/using-different-database-for-subdomain-website/#post-6319608)
 * I’m sorry I didn’t understand that last sentence you said, could you elaborate?
   Also, how else would I be able to choose website B to be displayed? Is there 
   a way to grab only website B and use it for the client without any other databases
   or content from any of the other websites I have created?
 *  [leejosepho](https://wordpress.org/support/users/leejosepho/)
 * (@leejosepho)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/using-different-database-for-subdomain-website/#post-6319660)
 * My curiosity as to how someone else would be interested in having a copy of a
   site and then the matter of duplicate content destroying SEO rating has to do
   with the difference between site content (database) and site display (theme).
   Someone with an existing site would likely want to keep his or her existing content(
   database) while simply adding a theme from you in order to change how that content
   is actually displayed.
 * > One of these sites I have completed and my client would like to replace his
   > old website with mine.
   > Is there a way to grab only website B and use it for the client without any
   > other databases or content from any of the other websites I have created?
 * To copy/move just one site from one place to another, export the database tables
   for that site by referencing the table_prefix for that site only as shown in 
   wp-config.php, and then also copy the wp-content folder for that site where its
   theme and media are stored.
 *  Thread Starter [patrickperte](https://wordpress.org/support/users/patrickperte/)
 * (@patrickperte)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/using-different-database-for-subdomain-website/#post-6319733)
 * Could you explain how to do that, or link me to a guide on how to replace the
   client’s website content with website B’s content only?
 *  [leejosepho](https://wordpress.org/support/users/leejosepho/)
 * (@leejosepho)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/using-different-database-for-subdomain-website/#post-6319735)
 * It would be helpful to first know exactly what you mean by this:
 * > One of these sites I have completed and my client would like to replace his
   > old website with mine.
 * Are you talking about a theme and its settings and a custom plugin or two or 
   are you talking about actual site content? Exactly what does your client want
   to have replaced?
 * edit: “Moving WordPress” is the default answer for some situations, but then 
   your client would lose *everything* he already has.
    [https://www.google.com/search?q=moving+wordpress](https://www.google.com/search?q=moving+wordpress)
 *  Thread Starter [patrickperte](https://wordpress.org/support/users/patrickperte/)
 * (@patrickperte)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/using-different-database-for-subdomain-website/#post-6319737)
 * My client has his own website, not created by WordPress. I created a website,
   using WordPress, and I would now like to replace his website with the one I have
   created. I did forget to mention that on his website’s cPanel, I created a subdomain
   and named it ‘newsite’. This subdomain is what uses the database from the website
   I created using WordPress. For now, I would just like to take the website I created
   and for newsite to look like it, so yes as you said, replace newsite’s content(
   as right now, it displays website A, my original, not the one I want, website
   B)
 *  [leejosepho](https://wordpress.org/support/users/leejosepho/)
 * (@leejosepho)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/using-different-database-for-subdomain-website/#post-6319739)
 * > on his website’s cPanel…a subdomain and named it ‘newsite’.
 * So then, right now you can access it by using ‘www.clentdomain.com/newsite/’,
   yes?
 * I would leave everything there exactly as it is and use .htaccess to simply redirect
   his domain to the ‘newsite’ folder.
 *     ```
       # BlueHost.com
       # .htaccess main domain to subdirectory redirect
       # Do not change this line.
       RewriteEngine on
       # Change example.com to be your main domain.
       RewriteCond %{HTTP_HOST} ^(www.)?example.com$
       # Change 'subdirectory' to be the directory you will use for your main domain.
       RewriteCond %{REQUEST_URI} !^/subdirectory/
       # Don't change the following two lines.
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-d
       # Change 'subdirectory' to be the directory you will use for your main domain.
       RewriteRule ^(.*)$ /subdirectory/$1
       # Change example.com to be your main domain again.
       # Change 'subdirectory' to be the directory you will use for your main domain
       # followed by / then the main file for your site, index.php, index.html, etc.
       RewriteCond %{HTTP_HOST} ^(www.)?example.com$
       # use index.php for WordPress
       #RewriteRule ^(/)?$ subdirectory/index.html [L]
       RewriteRule ^(/)?$ subdirectory/index.php [L]
       ```
   
 * [https://my.bluehost.com/cgi/help/347#redirect](https://my.bluehost.com/cgi/help/347#redirect)
 * Doing that will remove ‘newsite’ from the access URL without changing anything
   at all elsewhere.
 *  [leejosepho](https://wordpress.org/support/users/leejosepho/)
 * (@leejosepho)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/using-different-database-for-subdomain-website/#post-6319740)
 * Oops, I forgot something! Just prior to putting that edited .htaccess in place,
   go to the current ‘newsite’ URL and remove ‘/newsite’ from both boxes at Settings
   > General and save the changes. You will then lose access there until the .htaccess
   is in place to send clientdomain.com directly to the updated database expecting
   that URL.
 * Please accept my apology if this post is too late, but a fix is not difficult.
 *  Thread Starter [patrickperte](https://wordpress.org/support/users/patrickperte/)
 * (@patrickperte)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/using-different-database-for-subdomain-website/#post-6319742)
 * Does this completely replace the clients website with mine, or does it only replace
   newsite’s look?
 *  [leejosepho](https://wordpress.org/support/users/leejosepho/)
 * (@leejosepho)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/using-different-database-for-subdomain-website/#post-6319743)
 * Both installations remain just as they are and clientdomain.com gets redirected
   from one to the other…like taking the other fork in the road to go to a different
   location.
 *  Thread Starter [patrickperte](https://wordpress.org/support/users/patrickperte/)
 * (@patrickperte)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/using-different-database-for-subdomain-website/#post-6319744)
 * However, redirecting his domain to newsite would bring it to website A, not website
   B, correct?
 *  [leejosepho](https://wordpress.org/support/users/leejosepho/)
 * (@leejosepho)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/using-different-database-for-subdomain-website/#post-6319769)
 * Redirecting his domain to newsite will make it access and display whatever you
   have at newsite.
 *  Thread Starter [patrickperte](https://wordpress.org/support/users/patrickperte/)
 * (@patrickperte)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/using-different-database-for-subdomain-website/#post-6319803)
 * Ah ok, makes sense. You also mentioned doing this by exporting just website B’s
   database by doing something with the table and wp_config? Could you give me a
   guide on how to do this?

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Using different database for subdomain website’ is closed to new replies.

## Tags

 * [cPanel](https://wordpress.org/support/topic-tag/cpanel/)
 * [database](https://wordpress.org/support/topic-tag/database/)
 * [subdomain](https://wordpress.org/support/topic-tag/subdomain/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 13 replies
 * 2 participants
 * Last reply from: [patrickperte](https://wordpress.org/support/users/patrickperte/)
 * Last activity: [10 years, 11 months ago](https://wordpress.org/support/topic/using-different-database-for-subdomain-website/#post-6319803)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
