• Hi all,

    I use the following for my permalinks:
    /%category%/%postname%/

    This works well, except for links that are generated via wordpress to the category archives.

    Example:

    The category URL should be “/categoryname/”

    But wordpress generates the links as being “/category/categoryname/”

    I don’t want the links to say /category/, but rather just the name. When you go to /categoryname/ it displays fine. So why WP always generates links as being /category/categoryname/ I can’t figure out, but it’s giving me duplicate content problems in google.

    Is there a way to modify how WP prints out those links?

Viewing 3 replies - 1 through 3 (of 3 total)
  • I found an answer to this question (I was looking, as well) in a comment made to someone else’s blog. It’s a hack that you will have to do everytime you upgrade, but it’s fairly easy.

    On line 371 of the wp-includes/rewrite.php file, you’ll see the code:

    $this->category_structure = $this->front . 'category/';

    Now just remove the “category” from the string, and the code should look like:

    $this->category_structure = $this->front . '/';

    It actually worked better for me to remove 'category/' altogether to just leave ''.

    I just wanted to say “thanks!” for sharing this trick… I’m glad I searched the fora before posting a new thread asking this very question.

    Isn’t it possible to write a plugin that accomplishes this somehow? Isn’t there a ‘rewrite’ hook in the WP API?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Êtegory% Permalink makes two URLs’ is closed to new replies.