• Hi guys,
    (I posted this yesterday, but for some reason the post isn’t anywhere to be found… I know the forums were screwing up yesterday). Anyways:
    Here’s what I have in mind…
    First off, I did all of my Category pages with seperate index’s in different directories. Everything works fine and dandy. Here’s my problem though…
    Obviously all my links to categories generated by WordPress are pointing to the automatically WP-generated category pages. What I need to do is have the category permalinks to be set as “categories/THE-NAME-OF-THE-CATEGORY/”
    I realize there’s that option to do this with the .htaccess and such, as I did try it. But all that is virtual and it doesn’t actually link to the pages I created. WHat I need is for something like that to work, but ACTUALLY point the directories I made. (Keep in mind all I need is for it to generate the category link as the name instead of the ID)
    Is this possible?
    If not, is there any way I could just set up a redirect of some sort, which is sensitive to query strings (the “?c=3”)?
    Thanks 🙂

Viewing 15 replies - 1 through 15 (of 28 total)
  • hey i really like the site… how did you get each category in its own index page? I need to do this for a client and i’ve been mulling over it for 3 days trying different things without any success. Can you help?
    Thanks

    Hi Kelso,
    Do you mean you put the different index.php files in different directories? That’s not difficult with htaccess. (which you should really use 🙂
    You could for example create a rule for every directory and hardcode your category names in the first part of every rule.

    RewriteRule ^categoryname/?$ /directoryname/index.php?category_name=$1 [QSA,NC,L]
    RewriteRule ^anothercategoryname/?$ /anotherdirectoryname/index.php?category_name=$1 [QSA,NC,L]

    Or let’s say you were so well structured that you named your directories after your categories. Than you would be ready with something like:

    RewriteRule ^([_0-9a-z-]+)/?$ /$1/index.php?category_name=$1 [QSA,NC,L]

    hope this helps

    Thread Starter Kelso

    (@kelso)

    QUOTE:
    “Or let’s say you were so well structured that you named your directories after your categories. Than you would be ready with something like”
    You bet I am! 😀 Thank you for the Code!!!!!
    Yes, I put different index.php’s in different directories. You guys might ask why, but I did it because managing EVERYTHING from posts to categories to “special” pages, I am WAY TOO LIMITED. By adding a setting to that page it’s added to every page. I don’t want that. 😉
    Phoat:
    The above I mentioned should answer your question 🙂
    Just be sure to edit the first few lines in your index.php where it calls for the header PHP file, so that it points to the right path. 🙂

    hey kelso.. check this post out… i think this will make it easier for you.
    http://wordpress.org/support/4/6721
    It seems that WordPress will natively support permalinks by category in the next version.

    It seems like it is. By supporting category permalinks and using mod_rewrite, you can then redirect any permalinks generated by WordPress to a custom index. So that if you have http://yoursite.com/news/my_chesse_sandwich as a permalink, with mod_rewrite you can make this point to http://yoursite.com/news.php?p=##
    See where i’m going with this?

    last address should read…
    http://yoursite.com/news/index.php?p=##

    phoat is right. I mistakenly thought %category% was already in the permalink tag list. It’s not but it seems it will be soon. Sorry for the confusion i might have caused.

    Thread Starter Kelso

    (@kelso)

    Oh ok… I’ll just wait patiently then 😀
    (this is gonna kill me cause it’s the ONLY thing holding me back from finishing my site)
    *rips hair out*
    😉

    Kelso, I think this is the one feature that is holding EVERYONE back :).
    It’s great though at how responsive the developers are.

    Hey guys, if you look at the current nightly, I think they added this feature. I’m going to test it out tonight and let everyone know how it works.
    Yay!!!

    Thread Starter Kelso

    (@kelso)

    Awesome! Let us know! 🙂

    ok guys,
    I tried it (although it wasn’t in the nightlies, I had to download the files from the CVS).
    It works just like it should. It produces permalinks using the post’s category instead of the date, but…
    The permalink code generated for the .htaccess file for some reason doesn’t work and I don’t know enough about mod_rewrite to be able to make it work, so i’m still stuck if anyone can help me.
    Here are some thoughts on the whole thing tho.
    All my old posts that where permalinked with date instead of category will break now if i use it. It would be cool (or maybe I’m asking too much) if you can choose which categories get permalinks with %category% and which don’t, or maybe do it on a post by post basis. If you can choose which categories get %category% permalink treatment, then you can easily create the illusion of multiple blogs with just categories.

    What permalink structure are you trying to use?

    update:
    using permalink
    /archives/%category%/%year%/%monthnum%/%day%/%postname%/
    creates correct rewrite rules.

    Thanks. I have a fix ready to commit as soon as SourceForge comes back to life.

Viewing 15 replies - 1 through 15 (of 28 total)

The topic ‘“Faking” Category Permalinks’ is closed to new replies.