1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

remove 'category' in URL

Discussion in 'General Troubleshooting' started by raistriker, Apr 14, 2012.

  1. raistriker

    raistriker New Member

    Hi Admin,

    I am planning to use Hotaru CMS for some of my future bookmarking websites (niche sites). I just did install it locally and exploring its features, so far so good. ;)

    However, I am a bit lost when it comes to configuring the URL. I have enabled the user friendly URLs correctly, and now I wanted to remove some words in the URL like the 'category.' Ex. site.com/category/seo - I'd like to rename it to site.com/seo. How do I do this?

    Thank you in advance!

  2. PuckRobin

    PuckRobin New Member

    You cannot do that. In Hotaru there is no selectable custom permalink structure as Wordpress has.
  3. angolanmade

    angolanmade Well-Known Member

  4. valMETNG

    valMETNG Administrator Staff Member Admin

    Interestingly enough, I was just messing with this very thing yesterday. While I didn't remove /category/my_category, I did figure out how to change it to /c/my_category. Although, be warned: it requires changing a few base files, which is (generally) a no-no because it makes upgrades a real pain (not to mention that it can cause unexpected errors elsewhere that you don't realize). Also, so far, I've only looked through the base plugins that come bundled, so there might be places in other plugins I haven't yet discovered (not to mention I could have missed some in base).

    As I just did this yesterday, I haven't fully tested these changes and what their impacts might be. However, it's basically changing wherever you see 'category' (in quotes) to something else (which, in my case, was 'c'). Given the way hotaru is designed (i.e., the URL in key -> value pairs, with page hidden), I don't believe you can easily remove category completely. Perhaps you could create a plugin that would parse every URI and then reconfigure it. Another (and potentially easier) solution for someone who understands .htaccess would be to use .htaccess regex to mask out category.

    If you want to attempt it (after those disclaimers), I believe this is the complete inventory of everything I changed:
    • In /libs/PageHandling.php: lines 402 and 408
    • In /libs/Post.php: line 500
    • In /content/plugins/bookmarking/bookmarking.php: lines 503, 505, 577, 590, 603, 616, 629, and 642
    • In /content/plugins/categories/categories.php: lines 61, 63, 80, 96, and 173
    • In /content/plugins/categories/metatags/metatags.php: line 55
    • In /content/plugins/categories/sitemap/sitemap.php: lines 167, 179, and 206

    (Waits for the expected hand-slap for changing base files...)
  5. Nick

    Nick Well-Known Member

    An alternative is to simply not use categories at all.
  6. narc

    narc Well-Known Member

  7. angolanmade

    angolanmade Well-Known Member

    Thank you very much for the tip, I figured there had to be a simpler way to make this happen and the rewrite condition in the htaccess file is exactly what i was looking for.

Share This Page