• 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 its own database. I saw no option to download subdomain Bs 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)
  • 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

    (@patrickperte)

    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?

    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

    (@patrickperte)

    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?

    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

    Thread Starter patrickperte

    (@patrickperte)

    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)

    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

    Doing that will remove ‘newsite’ from the access URL without changing anything at all elsewhere.

    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

    (@patrickperte)

    Does this completely replace the clients website with mine, or does it only replace newsite’s look?

    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

    (@patrickperte)

    However, redirecting his domain to newsite would bring it to website A, not website B, correct?

    Redirecting his domain to newsite will make it access and display whatever you have at newsite.

    Thread Starter patrickperte

    (@patrickperte)

    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.