WordPress.org

Support

Support » How-To and Troubleshooting » Create permalink with category as hostname?

Create permalink with category as hostname?

  • Hiya. Long time lurker, first time n00b Steve here. I’ve got a simple question that will probably require a complex answer, so here goes.

    How do I create a permalink structure that like: ‘%category%.myblog.com/%postname%’?

    I am using WP 2.04 on dreamhost at http://quicksilverscreen.com/, so what I’m looking for is for my Linux posts to be located at http://linux.quicksilverscreen.com/, and my funny posts to be at http://funny.quicksilverscreen.com/. I’m stumped, so any help would be much appreciated.

    I’ve tried just sticking that into the permalink options, but it seems to just ignore everthing before ‘/%postname%’. Arggh. I want each category to have it’s own hostname, why is this soo hard?

    I could write my own mod-rewrite script, and I’ve already set up the DNS wildcard, now if only I could get WP to spit out URL’s in the expected format.

    My twelve readers are counting on me to bring them the latest useless news, and pointless trivia! Without your help almost a DOZEN faithful readers may have to live without my pointless, shortsighted ramblings!

    Thanks!
    Steve.

Viewing 3 replies - 1 through 3 (of 3 total)
  • That’s not “hostname” – as you put it in the title: that’s subdomain.
    WP’s nice permalinks don’t create and don’t imitate subdomains. You have to live with that (as well as the 12 🙂

    @moshu – You know, my mom once told me something similar about my goal to become the worlds fattest starving artist. I told her to scrump off, and I did it anyhow.

    Now I shall tell you the same thing. With god as my witness, I SHALL have subdomain based permalinks, even if it kills you*. 🙂

    * So long as it doesn’t involve actual work.

    Ok. I got it to mostly work now. I just inserted the following code in template-functions-links.php on line 80:


    $cats = get_the_category($post->ID);
    $category = $cats[1]->category_nicename;
    $home = "http://$category.quicksilverscreen.com";

    Notice that I used $cats[1], but thats because my first category $cats[0] is always ‘All’. YMMV.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Create permalink with category as hostname?’ is closed to new replies.
Skip to toolbar