Wordpress Category as Subdomain Plugin

This is a plugin which I adapted from an older version (see History). I made the required adaptations to Wordpress 2.6.2 about a month ago after I saw that it isn’t properly working and that comments on the developer’s blog go unanswered.

I debated releasing this plugin for a couple of weeks but after seeing so many people trying to get it to work I decided to release it on my blog. My personal project relied heavily on sumdomained pages and this function has been tested in full. The category part of this plugin, while adapted and seems to work properly has not been fully tested by me and I would appreciate any comments about any problem you may have ran into.

Description:
This plugin will take a category of your choice (i.e. www.myblog.com/some-category/) and will turn it into a subdomain (i.e. somecategory.myblog.com/).

History:
This plugin was initially written and released under the name Subster Rejunevation by Dax (aka BiggNuts) and maintained until version 2.1 of Wordpress.

Next Adam Dempsey took a stab at adapting it for Wordpress 2.5, however, according to the comments the plugin did not work properly beyond Wordpress version 2.2.2.

I took this plugin, adapted all functions to work properly on Wordpress 2.6.2 and released on 9/20/08.

Todo:
Subdomain tags

Download:
* Version 0.44

Related Entries:

  • Redirect non-www to www in Wordpress
  • Comments (8) to “Wordpress Category as Subdomain Plugin”

    1. Great Ill test this plugin and see if it works

      [Reply]

    2. thank you for releasing this plugin. i will give it a try and report back.

      do you know if it is possible to map 2 categories to the same subdomain?

      many thanks,
      selise

      [Reply]

    3. ok, i gave it a first try, and there is one problem - although i’m not sure it should be called a bug:

      all the categories get turned into subdomains - that won’t work as i need to have some categories used just for the main domain.

      i expect i’m not alone in needing to have some categories not turned into subdomains. so here’s a suggestion:

      do with categories, just as you do with the pages:

      “To make pages act as subdomains set a custom field with the key of subdomain_me to “true”

      To tie a pages to a category subdomains set a custom field with the key of tie_to_category to to category ID”

      1. do not turn a category into a subdomain unless a custom field with the key of subdomain_me is set to “true”

      2. permit multiple categories to be tied together in one category’s subdomain by setting a custom field for the categories with the key of tie_to_category to the category ID of the shared subdomain.

      item 1. above is the most critical. without it, i can’t use the plugin for categories. i hope that is something you can easily add - and i’ll be anxiously awaiting the chance to try it again.

      best,
      selise

      [Reply]

      GiladG Reply:

      Item 1: There is a “Make Subdomain” option as a part of the “Edit Category” page. However, it is not a part of the “Add Category” page. So all you’ll need to do is create the category and then edit it to determine if it is to be sub-domained or not.

      *I will look into adding it to the “Add Category” as well.

      Item 2: I am not sure I understand what it is you with to do. Have a category “Cars” and category “Morotcycle” and have posts from both appear under “cars.mysite.com”?

      [Reply]

      selise Reply:

      Thanks!

      item 1: i did not look at the “edit category” page - will give that a try.

      item 2: yes. that’s it exactly.

      [Reply]

    4. some preliminary testing notes:

      Item 1: There is a “Make Subdomain” option as a part of the “Edit Category” page. However, it is not a part of the “Add Category” page. So all you’ll need to do is create the category and then edit it to determine if it is to be sub-domained or not.

      a) i already have lots of categories - and lots of subcategories, most of which i don’t want to be subdomains. if there is any easy way for you to have the categories default to not having the “Make Subdomain” box checked that would be helpful - but not necessary. i can go through and edit all of them to uncheck the box.

      b) i’m confused about the way subdomains are handled. i have a parent category that i want to use a subdomain for. if i both the parent category and subcategories checked for “Make Subdomain” then the urls for individual posts are changed

      from:

      http://www.mysite.com/year/month/post-name/

      to:

      http://parent-category.mysite.com/subcategory/year/month/post-name/

      but shouldn’t it be:

      http://parent-category.mysite.com/year/month/post-name/

      new item: i get an error msg:

      Too many redirects occurred trying to open “[http://www.mysite.com/category/my-category/]”. This might occur if you open a page that is redirected to open another page which then is redirected to open the original page.

      for links to category pages:

      http://www.mysite.com/category/my-category/

      it is only in the category sidebar widgets than the redirection seems to happen correctly.

      another new item (small):

      also on the edit category page, the link:

      Pick your theme name and activate category themes in Options/Subdomains

      gives the following error msg:

      Cannot load subster-rejuvenation.php.

      ….

      many thanks again,
      selise

      [Reply]

    5. I don’t know what i’m doing wrong but it’s not working for me. I enabled “Make Subdomain” for a category, and when i click on it on my blog (categoryname.sitename.dk) i get the error; “Not Found
      The requested URL / was not found on this server.”

      [Reply]

      GiladG Reply:

      Did you enable “Wildcard Subdomains” on that domain?

      [Reply]

    Post a Comment
    *Required
    *Required (Never published)