Slightly strange question, I want my Wordpress blog to use subdomains as permalinks, a bit like the popular website "The Setup".
I already have Apache configured to load the site irrespective of the subdomain, I jus开发者_StackOverflowt need to work out how to make Wordpress load the right post. I have my permalink structure set as "/%postname%/" as I will manually ensure the post names are unique.
All I need to work out is how to get the subdomains mapped to the postname - I'm guessing it requires mod_rewrite? But I'm unsure how to proceed.
Thanks
I'm using nginx for The Setup, so I'm not sure if that will help you much at all (nor can I guarantee that this is the best way to do it) but my config looks something like this:
location = / {
if ($host ~* "^([a-z0-9+\.\-]+)\.usesthis\.com$") {
set $interview $1;
}
if ($interview !~* '^(www)?$') {
rewrite ^(.*)$ /interviews/$interview.html;
}
}
}
The best way to accomplish this with Wordpress core features seems to be the "Create a Network" feature - formerly Wordpress Multi-Site (MU).
All you have to do is add a line to your wp-config.php file to begin the setup options from the Wordpress dashboard.
There are details here: http://codex.wordpress.org/Create_A_Network
However, be advised that at this time they are slightly out of date in terms of what the screens look like, and the workflow. (For example, once you've gone through the process, now instead of entering the Network Admin interface from the top left link in the admin dash bar, the link is in the top right and looks a bit different).
精彩评论