Make WordPress Core

Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#16662 closed defect (bug) (fixed)

Permalinks not working with 'category'

Reported by: ipstenu's profile Ipstenu Owned by:
Milestone: 3.1.1 Priority: normal
Severity: critical Version: 3.1.3
Component: General Keywords: has-patch
Focuses: Cc:

Description

Okay, there are a handful of people, MOSTLY on IIS, who are having permalinks problems.

Basically categories don't work. They're finding out when they use /%category%/%postname%/ for permalinks. If they use default (ugly) URLs, it's fine. If they use pretty permalinks with /%year%/%month%/%day%/%postname%/ the post URLs work but the category ones do not.

I can't reproduce it, but so far I've noted

If they use IIS, this often fixes it
http://wordpress.org/extend/plugins/permalink-fix-disable-canonical-redirects-pack/

It manifest as EITHER 404s OR a refresh-loop.

I'm not sure if it's really a bug or not, and since I can't reproduce it, I'm gonna list the slew of posts with this problem. Yes, they've tested with the default themes, and that doesn't help.

http://wordpress.org/support/topic/category-permalinks-after-31-upgrade-not-working
http://wordpress.org/support/topic/wp-31-permalinks-still-broken-after-many-trys-with-fixes-described
http://wordpress.org/support/topic/permalinks-broken-and-images-not-showing-with-network-install
http://wordpress.org/support/topic/worpress-site-will-not-stop-refreshing

Attachments (3)

16662.diff (822 bytes) - added by greuben 14 years ago.
16662.2.diff (905 bytes) - added by greuben 14 years ago.
16662.3.diff (1.2 KB) - added by greuben 14 years ago.

Download all attachments as: .zip

Change History (26)

#1 @nacin
14 years ago

  • Milestone changed from Awaiting Review to 3.1.1

#2 @ryan
14 years ago

See also #16639

#3 @reviewmylife
14 years ago

Some more information to help you reproduce this - I got this on one of my blogs when I upgraded to 3.1. It is on an Apache server. All the category / tag pages now give a 404 error when accessed from the existing URLs.

WordPress address (URL): http://www.[MYBLOG].co.uk/blog
Site address (URL): http://www.[MYBLOG].co.uk
Permalink custom structure: /blog/%year%/%monthnum%/%day%/%postname%/
Category base:
Tag base:

Update (the category links in the posts are now consistent with the actual category locations (maybe I was looking at a cached page previously) - so the issue now is that the urls changed from '/blog/category/...' to '/category/...' when WP was updated.

The categories were previously in this form:
http://www.[MYBLOG].co.uk/blog/category/japan/

Now they have moved to:
http://www.[MYBLOG].co.uk/category/japan/

If I add 'blog' to the 'Category Base' then all the single posts start giving a 404.

As a temporary workaround I have added a 302 redirect from the location where the categories / tags were previously to their new location:

RewriteRule ^blog/category/(.+)$ http://www.[MYBLOG].co.uk/category/$1 [R=302,L]
RewriteRule ^blog/tag/(.+)$ http://www.[MYBLOG].co.uk/tag/$1 [R=302,L]

Maybe I'll make this a 301 redirect as the category/tag URLs do look better without the 'blog'.

However adding an entry to the 'Category base' still shouldn't cause all posts to 404 - especially as the category has no part in the post URL.

Last edited 14 years ago by reviewmylife (previous) (diff)

#4 @reviewmylife
14 years ago

  • Cc reviewmylife added

#5 @nacin
14 years ago

  • Severity changed from normal to critical

I've been unable to reproduce. If someone is willing to give me access to an install where I can reproduce it, I should be able to track this down. My email is my username here, at wordpress.org.

#6 @ryan
14 years ago

Looking at those threads, the category problems seem to be with certain plugins, particularly Simple Tags. Simple Tags just pushed a new version that I can't reproduce the problem with. The refresh loops are probably #16639.

#7 @ryan
14 years ago

See also #16703

@greuben
14 years ago

#8 @greuben
14 years ago

  • Keywords has-patch added

In 3.0.5, for categories we have used $this->front which includes the static string included in the permalinks whereas in 3.1 we have set with_front => false

In case of @reviewmylife,
3.0 -> category urls are like /blog/category/
3.1 -> category urls are /category/ due to the with_front => flase

@greuben
14 years ago

#9 @nacin
14 years ago

Wow, that's funky. Not sure I ever noticed that.

#10 @greuben
14 years ago

That could be the cause for 404's. Not sure what is causing infinite redirect loop.

#11 @aaroncampbell
14 years ago

A fix ([17493]) for the redirects issue (#16639) went in. Can anyone that's having this problem please test to see if that fixed this as well?

#12 @ryan
14 years ago

Verified that 3.0 includes front and 3.1 does not. 16662.2.diff makes 3.1 category links look like 3.0.

@greuben
14 years ago

#13 @greuben
14 years ago

Updated the patch, it also solves #16733 with a revert of [16918]

#14 follow-up: @reviewmylife
14 years ago

I gave the 16662.3.diff patch a go on a test blog.

The URLs were changed so they now are in the form '/blog/category/' as before. However if I go to any of those URLs I get a 404.

If you want debug logging out of my site I'm happy to install a debug (logging to file) version of taxonomy.php or rewrite.php if give me the code.

#15 in reply to: ↑ 14 ; follow-up: @greuben
14 years ago

Replying to reviewmylife:

I gave the 16662.3.diff patch a go on a test blog.

The URLs were changed so they now are in the form '/blog/category/' as before. However if I go to any of those URLs I get a 404.

If you want debug logging out of my site I'm happy to install a debug (logging to file) version of taxonomy.php or rewrite.php if give me the code.

16662.3.diff will not work as expected if you have not reverted [16918]

Also, make sure you've flushed your rewrite rules (just visit Settings -> Permalinks)

#16 @reviewmylife
14 years ago

Thanks for the extra details. After reverting that change the categories and tags now work as expected :)

#17 in reply to: ↑ 15 ; follow-up: @ashfame
14 years ago

  • Cc ashishsainiashfame@… added

Replying to greuben:

16662.3.diff will not work as expected if you have not reverted [16918]

Also, make sure you've flushed your rewrite rules (just visit Settings -> Permalinks)

I tried your patch (also reverted [16918]) on one of the affected sites but still category and tags pages return 404. Please note that Advanced Permalinks plugin (known to cause issues with WP 3.1) was in use when it was upgraded, so it might have to do something with that. Its disabled at the moment.

I recreated my .htaccess file after making changes in files. Anything else that I should try?

Permalink custom structure: /%postname%/
Category base: cat
Tag base:

Edit: My forum thread detailing things is http://wordpress.org/support/topic/wordpress-category-gives-404-after-moving-to-a-different-domain?replies=22

Last edited 14 years ago by ashfame (previous) (diff)

#18 in reply to: ↑ 17 ; follow-up: @greuben
14 years ago

Replying to ashfame:

Replying to greuben:

16662.3.diff will not work as expected if you have not reverted [16918]

Also, make sure you've flushed your rewrite rules (just visit Settings -> Permalinks)

I tried your patch (also reverted [16918]) on one of the affected sites but still category and tags pages return 404. Please note that Advanced Permalinks plugin (known to cause issues with WP 3.1) was in use when it was upgraded, so it might have to do something with that. Its disabled at the moment.

I recreated my .htaccess file after making changes in files. Anything else that I should try?

Permalink custom structure: /%postname%/
Category base: cat
Tag base:

Edit: My forum thread detailing things is http://wordpress.org/support/topic/wordpress-category-gives-404-after-moving-to-a-different-domain?replies=22

I've just tried it with /%postname%/ permalink and 'cat' as category base. It is working for me.

Permalinks are broken only if I use that "Advanced Permalinks" plugin. After disabling it did you flush rewrite rules?

#19 in reply to: ↑ 18 @ashfame
14 years ago

Replying to greuben:

Replying to ashfame:

Replying to greuben:

16662.3.diff will not work as expected if you have not reverted [16918]

Also, make sure you've flushed your rewrite rules (just visit Settings -> Permalinks)

I tried your patch (also reverted [16918]) on one of the affected sites but still category and tags pages return 404. Please note that Advanced Permalinks plugin (known to cause issues with WP 3.1) was in use when it was upgraded, so it might have to do something with that. Its disabled at the moment.

I recreated my .htaccess file after making changes in files. Anything else that I should try?

Permalink custom structure: /%postname%/
Category base: cat
Tag base:

Edit: My forum thread detailing things is http://wordpress.org/support/topic/wordpress-category-gives-404-after-moving-to-a-different-domain?replies=22

I've just tried it with /%postname%/ permalink and 'cat' as category base. It is working for me.

Permalinks are broken only if I use that "Advanced Permalinks" plugin. After disabling it did you flush rewrite rules?

Yes I resaved my permalinks. I think they get flushed on visiting the permalinks setting page only or I need to do that explicitly?

#20 @markjaquith
14 years ago

  • Resolution set to fixed
  • Status changed from new to closed

Prevent double index.php preprend on PATHINFO custom taxonomy permalinks. Proper use of with_front. props greuben. fixes #16773. fixes #16662. see #15813. see #12659. For trunk

#21 @markjaquith
14 years ago

Prevent double index.php preprend on PATHINFO custom taxonomy permalinks. Proper use of with_front. props greuben. fixes #16773. fixes #16662. see #15813. see #12659. For 3.1

#22 @mskogly
13 years ago

  • Version changed from 3.1 to 3.1.3

#23 @lafayettenuke
13 years ago

I'm seeing the same error in WordPress 3.1.3 Multisite on two different subdomain-based sites (they're development web sites, so I can't share the urls) on a LAMP server, using the "Day and name" configuration. Both work fine with ugly URLs. There are no category related plugins installed.

Other, non-subdomain sites I've upgraded aren't having this problem.

Note: See TracTickets for help on using tickets.