简体   繁体   中英

Use same database on main domain & sub domain in wordpress

I have a main domain https://www.pearltutorial.com and I also have a subdomain http://besttutorial.pearltutorial.com

I want both the domains to use the same database when visited. I've tried using Multisite but it isn't working.

Any ideas on how to do this?

Generally, that's not possible.

Because, each WordPress installation has its own settings, post data, tags, etc. Every WordPress installation is unique and so its database. What you're asking for, is a custom application.

Also, never give the same database credentials to both the WordPress installations. It doesn't work that way and you end up with some alien stuff.

But it's possible if...

you are a coding pro, and you could build your own fork of WordPress that can extract data from a foreign database and insert into its own.

Or, you can build an API for your existing WordPress database and can call it from your custom-built application and process the data.

Even if you successfully implemented that, you end up losing your search rankings as it would become duplicate content [the same content on two domains or pages]. Google penalizes you.

Either way, you should be a pro. As far as I can understand, what you want is a special domain to showcase your best tutorials. You can implement that by creating a special post or tag category, best and tagging those posts under the best .

If I understand, you need more than one WordPress installations but you are limited MySQL Database allowance. In that case, multiple WordPress Installation into a single database is possible and it's not so difficult.

  1. The first of all you must install WordPress manually.
  2. During the installation in your wp-config.php phase, you need to change the prefix "wp_" in order to allow multiple installations. For example, the first can be "wpptl_" and the next can one be "wpbptl_".

You can use different prefix and use them to create as many installations as you need.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM