I am searching to show exactly the same WordPress blog on the mobile subdomain and also the primary domain inside a subfolder. This could seem like the next:

  • example.com/blog/ (with primary theme and customisations)
  • m.example.com/blog/ (with mobile theme and customisations)

However, is possible or should i use a separate blog and duplicate content to the mobile blog in the primary blog?

PS - Just a test atmosphere at this time, and that i will handle user-agent switching and SEO duplicate content factors.

This really is possible however, you there is no simple inconspicuous solution.

There's One easy method of doing this. Hack the core, find wp_set_wpdb_vars() in wp-includes/load.php and immediately after $prefix = $wpdb->set_prefix( $table_prefix ); add this:

if($_SERVER['SERVER_NAME'] == 'm.domain.tld'){
    $wpdb->options = "mobile_{$wpdb->options}";
    $wpdb->postmeta = "mobile_{$wpdb->postmeta}";
    $wpdb->commentmeta = "mobile_{$wpdb->commentmeta}";
}else{
    $wpdb->options = "mobiless_{$wpdb->options}";
    $wpdb->postmeta = "mobiless_{$wpdb->postmeta}";
    $wpdb->commentmeta = "mobiless_{$wpdb->commentmeta}";
}

This trick will sandbox options and metas into two different teams of tables. By doing this they're not going to overwrite but when you utilize different configurations for plug ins installed. You can easily sandbox the options table for those who have treatments for plug ins and stop configurations collision.

Inside your wp-config.php you will have to do that:

if($_SERVER['SERVER_NAME'] == 'm.domain.tld'){
    require_once(dirname(__FILE__).'/wp-config-mobile.php');
}else{
    require_once(dirname(__FILE__).'/wp-config-mobiless.php');
}

Both should have same configurations (dbname, prefix) except WP_SITEURL and WP_HOME. You should use one file if you do not hard define WP_HOME and WP_SITEURL within the [cde].