WordPress.org

Ready to get started?Download WordPress

Forums

Customised category permalinks (3 posts)

  1. absalom
    Member
    Posted 4 years ago #

    I've got some highly customised permalinks on a site I'm working on for a client. The short story is that the permalinks are working incorrectly for category links. Post and page links work fine. Just the category links remain broken.

    Article permalinks are set at: /articles/%post_id%.htm
    Currently category permalinks spit out: /topics/%category slug%

    The issue is that I've used the category slug for the full description of the category as it's been a major migration project just to get it this far.

    Is there any way to rewrite the permalinks as: /topics/%category id% ?

  2. Shane G.
    Member
    Posted 4 years ago #

    Hi,

    In order to remove a category from the permalink of category, you need to first backup your .htaccess file. After that open it and add this code:

    RewriteRule ^category/(.+)$ http://www.yourblog.com/$1 [R=301,L]

    Now, If your categories page default URL is:

    http://www.bestwpthemez.com/category/

    Once you save above code in htaccess, it will be set at:

    http://www.bestwpthemez.com/

    That’s it!

    Thanks,

    Shane G.

  3. absalom
    Member
    Posted 4 years ago #

    Shane

    That's not really the rewriting rule I'm looking for. I need a category slug permalink that can handle ampersands and spaces and/or rewrite to the category number.

    Think I might revisit my migration procedure and just preg_replace/json_encode the category slugs as a workaround.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.