0

I have setup several categories and set the permalinks to /%category%/%postname%.html with a category base of . to remove "category" from the url.

All categories are working except for one with the slug music. It returns a 404 (I turned of guessing a target for automatic forwarding). The strange thing is that if I rename the slug (to anything, "tmusic" works for example, so does "musict"), the link works. If I rename it back to "music" it gives 404 again. Unfortunately renaming is not an option.

Default permalinkstructure also works, but is also not an option.

I also tried renaming name and slug of that category and creating a new category with the slug "music" this one now also gives a 404. So the problem seems to be specific to /music.

get_category_by_slug("music")

gives

object(stdClass)#224 (16) { ["term_id"]=> &int(4) ["name"]=> &string(5) "Music" 
["slug"]=> &string(5) "music" ["term_group"]=> int(0) ["term_taxonomy_id"]=> int(4) 
["taxonomy"]=> string(8) "category" ["description"]=> &string(0) "" 
["parent"]=> &int(0) ["count"]=> &int(552) ["filter"]=> string(3) "raw" ["cat_ID"]=> &int(4) 
["category_count"]=> &int(552) ["category_description"]=> &string(0) "" ["cat_name"]=> &string(5) "Music" 
["category_nicename"]=> &string(5) "music" ["category_parent"]=> &int(0) }

All of this should rule out any id or database mess.

The contents of my .htaccess are:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>

# END WordPress

There is another .htaccess in a parent folder of wordpress, but I renamed it to make sure that one doesn't cause problems. Still 404.

Any ideas on where/what I could look at? Anything I could do to find the source of that error or narrow down possible sources? Whats the best chance to track down what the url is actually resolved to?

Are the permalinks cached somewhere? I imported some posts with a database script and changed id's of categories.

The only installed plugin is Contact Form 7.

5
  • What do you mean by a base of dot (.) ? Do you have any other terms or CPTs that have music in them?
    – Rarst
    May 16, 2014 at 15:16
  • "." as in this folder, ".." would be parent folder. If category base is left blank, wordpress defaults it to category, which results in an extra /category/ in the url. (If I remove the dot I get 404 for <baseurl>/category/music/ and all other categories work with and without dot)
    – cytofu
    May 16, 2014 at 20:20
  • I have one other category having "music" somwhere in the middle of the slug. I renamed it, flushed (now All categories stopped working), resaved permalinks page(now all categories Except music, work again) still 404
    – cytofu
    May 16, 2014 at 20:43
  • 2
    Possibly related to the fact that removing the category or tag base that way is not supported, that it sort of works is mostly accidental. If you search around, there are some plugins which will remove the category base and probably eliminate this issue, if that is indeed the cause. From Using Permalinks, Category base and Tag base: You can change them, but you can't remove them from the URLs altogether.
    – Milo
    May 16, 2014 at 21:37
  • I don't know what I messed up when I tried this before, but this really fixed it. Can you add it as an answer so I can accept it? Why would the category base be vital for anything? I guess to avoid name collisions? So the way to go is 301.
    – cytofu
    May 16, 2014 at 22:23

1 Answer 1

1

Permalinks are cached in wp_options and every time you update them in the code, you should flush them.

Visiting wp-admin/options-permalink.php does the trick. Optionally you can try to resave that page, despite the resave is not needed, but is worth nothing.

1
  • I tried the above before and now again, just to be sure. The problem remains. I temporarily added $wp_rewrite->flush_rules( true ); to functions.php and visited and resaved the permalink page multiple times (changed values to make sure it is saved)
    – cytofu
    May 16, 2014 at 20:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.