0

I am tring to make 2 sites (1 domain and 1 subdomain) in WordPress. Subdomain should have different logo,menu,ads..etc but both of them,same database with same article.I know it is risky for Google, but I have other plans with this. I upload wp to principal domain and subdomain. In wp-config I put same database, but the links displayed on subdomain are exactly like the ones from principal. Here is a domain example: http://wow7.ro and a subdomain one: http://lol.wow7.ro . I try to duplicate wp prefix _options table in phpmyadmin to have different siteurl, but I can not find the php file in wp structure where is the code which selects this from duplicate table.

1

Do not alter any table names. In both sites (just to be sure) in wp-config.php set the WP_SITEURL and WP_HOMEURL to the related domain so these constants should be http://wow7.ro on the main domain install and http://lol.wow7.ro on the subdomain install.

See Codex.

Note that it doesn't work for links insrted inside post or page content, because they are saved statically in post content, so in the database, and once the database is the same...

Also note that if you install some caching plugins it can brings problems...

After that inside the template you can use that constants also to conditional show content in the site:

if ( ! defined('WP_SITEURL') || WP_SITEURL = 'http://wow7.ro' ) {
  // do something for main domain
} else {
   // do something for subdomain
}

PS: in WordPress multisite means a WordPress installed with network of sites enabled, and this not seems your case.

  • I've done exactly that. But for some reason. Theme loads but all linked css/js/media goes to server not found or 404 (not handled by theme). – Sisir Jun 13 '14 at 8:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.