Use single-site install and map entities to subdomains

Not sure if this is a pipe-dream, but I am interested in the URL rewriting capabilities (and DNS mapping) of a single-site WordPress install.

Typically in a WordPress MU setup, we’d use WordPress Mu Domain Mapping to map new sites/installs to a domain/CNAME.

What I’d be after is if it’s possible to map a single-entity, like a user to a CNAME on the registrar.

For example, let’s say we have a bunch of users in a single-site install. Ideally, these users would be accessed via YOURSITE.COM/johndoe (using get_user_by() which is an additional question).
Then, on the registrar level, you setup a CNAME that has a value of us.OURDOMAIN.COM and point it to the IP address of the site. From there, WordPress is able to determine that us.OURDOMAIN.COM should load YOURSITE.COM/johndoe.

Any initial thoughts on this would be greatly appreciated. Thanks as always!

1 Answer
1

I hope you are still interested in this question. I did a sub domain mapping to a custom post type using custom .htaccess setting.

RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} ^(.+)\.domain-name\.com$
RewriteRule ^$ /index.php?store=%1 [L]

Using this setting, each sub domain will map to the store custom post type. http://apple.domain-name.com will be equal to http://domain-name.com?store=apple or http://domain-name.com/store/apple/ if you are using the pretty permalink.

Note that you will need to modify the pager if you want to map the sub domain to category or custom taxonomy.

Leave a Comment