How to create subdomain for custom post type and associated custom taxonomies

While multisite would give you exactly what you wanted via domain mapping, you’ve opted to throw away this option in favour of the much more time consuming and harder method of manual htaccess rewrites etc.

The challenges you face include:

  1. Telling wordpress to rewrite the permalink URLs it outputs to shop.mysite.com but not for the whole site
  2. Redirecting users who arrive at mysite.com/shop/some-post
  3. handling the wordpress permalink infrastructure

How you would make it work without multisite:

  1. You would have to write out all your own permalinks, or add a hook so that get_permalink/the_permalink and the menus, etc all use the right domain
  2. You would need to setup a htaccess at shop.mysite.com so that it mapped on to the normal page. You would then need to check for the referrer at the normal page to redirect to the subdomain if its found.
  3. You would need to add the shop prefix in the rewrite when you register your custom post type
  4. When handling the subdomain, you will need to account for the /shop prefix else you will have shop.mysite/shop/some-post

OR

You could set up a second wordpress install on the shop subdomain with the same tables etc. This would be easier than the above, but would introduce certain other issues, and you would need two themes, hardcoded to filter out the content from the other counterpart.

How you would make it work with multisite:

  1. You would create a second site for the shop subdomain
  2. HTAccess rules would be added to forward any request to mysite.com/shop on to shop.mysite.com
  3. When you want to display shop items on the mainmysite.com domain, you would do the following:

http://codex.wordpress.org/Function_Reference/switch_to_blog

switch_to_blog($shopsiteID);
// display shop items
restore_current_blog();

As you can see doing it without multisite is considerably more work than doing it with multisite, since a lot of the work you would need to do has already been done to implement multisite.

I would recommend you attempt them in the following order:

  • multisite easy
  • Two installs hard ( cookie/upload hell )
  • One install hardest ( permalink hell )

The only solution that will get you what you want without massive kludges is the multisite option coupled with domain mapping. I estimate not using multisite will triple the number of hours and cost of this task with no guarantee of a satisfactory result at the end.

So yes, you do not need multisite, just like I don’t need tires on my car, it is doable, but why make things hard for yourself. Multisite is going to be suggested a lot to you, because it is the easiest, simplest, fastest and safest means of doing it.