Support » Plugins » Multiple Category Bases

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter rh2600

    (@rh2600)

    *bump* *bump*

    if I have this right, you want 2 dominate category bases:

    yoursite.com/projects
    yoursite.com/blog

    from that you want subcats under each

    projects
    -house

    blog
    -house

    This is doable. Simply create a category for Projects, and a category for Blog, then create ‘house’ under each.

    I have Romance as a subcat of Books, Submissions & Reviews.

    But to differentiate between the three, I also define my “romance” sub cat when creating under multiple cats.

    romance-review
    romance-books
    romance-submissions

    Then, I use Links Manager to produce “Romance” link without the add ons in each specific category.

    Thread Starter rh2600

    (@rh2600)

    But in order to tell WP that I am wanting to look for categories, don’t I need to include the “Category base:” in the url?

    Such as:

    yoursite.com/category/romance

    Here I want to have multiple versions of the category base “category”.

    Let me see if I get this right: You have two categories, “house” and “story”, and you have one category base setup in wordpress (I will assume it is “blog”)

    You could write a .htaccess rule to allow the “projects” category base to work: (I’m too sleepy to write .htaccess rules or regular expressions right now, maybe somebody else can do it for you, or I’ll try to get back at you later]

    If you are using WP 1.5, you can see the wordpress generated .htaccess rules, and just find the ones for the “blog” category base, copy them and edit them to use the “projects” category base instead, but outside the “WordPress” section in the file.

    If you are using WP 2.0, you could look up a 1.5 style rule, or just write one to convert the a section sortof like ^/projects/(.*)$ to /blog/$1 and don’t give it the flag which tells mod_rewrite to not evaluate any more rules. (I think that one is [L])

    If you don’t follow this, read up on mod_rewrite, and make sure you back up your .htaccess before you mess with it.

    I’m a little more awake now, and I grabbed and tweaked old WordPress 1.5.2 mod_rewrite rules for category URLs. I would try these (If possible, in a test environment rather than “live”) out:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^projects/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?category_name=$1&feed=$2 [QSA,L]
    RewriteRule ^projects/(.+)/(feed|rdf|rss|rss2|atom)/?$ /index.php?category_name=$1&feed=$2 [QSA,L]
    RewriteRule ^projects/(.+)/page/?([0-9]{1,})/?$ /index.php?category_name=$1&paged=$2 [QSA,L]
    RewriteRule ^projects/(.+)/?$ /index.php?category_name=$1 [QSA,L]
    </IfModule>

    [Note: Each RewriteRule is on one full line, no matter how long, even though they are wrapped here in the forum post]

    You will already have a .htaccess file; insert the code above in front of the #BEGIN WordPress line in it.

    You may need to change the /index.php? to read /path/to/index.php? if you did not install the blog to be accessed from your http://www.site.com root directory. I am assuming that “projects” is the extra category base you want to have work, and that the “blog” category base is set up in the wordpress permalink options. If it is the other way, just change “projects” to “blog” on each of the RewriteRule lines.

    Thread Starter rh2600

    (@rh2600)

    Awesome, thanks I’ll give this a whack, its looks pretty much like what I am after.

    Cheers 🙂

    davidhosier

    (@davidhosier)

    Did anyone get this to work? I tried the rewrite rules and they didn’t work on my installation of WP 2.0.2.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Multiple Category Bases’ is closed to new replies.