WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#16662 closed defect (bug) (fixed)

Permalinks not working with 'category'

Reported by: 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 3 years ago.
16662.2.diff (905 bytes) - added by greuben 3 years ago.
16662.3.diff (1.2 KB) - added by greuben 3 years ago.

Download all attachments as: .zip

Change History (26)

comment:1 nacin3 years ago

  • Milestone changed from Awaiting Review to 3.1.1

comment:2 ryan3 years ago

See also #16639

comment:3 reviewmylife3 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:

Possibly of significance is that my WordPress address and Site address are different? On another of my blogs where they are the same there was no problem.

The categories are supposed to be in this form (and all the category links that WordPress generates still points to this structure):
http://www.[MYBLOG].co.uk/blog/category/japan/

However the actual category page has now moved to:
http://www.[MYBLOG].co.uk/category/japan/

Which is why the existing URLs give a 404.

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 are supposed to be to the location where they currently are:

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]
Version 0, edited 3 years ago by reviewmylife (next)

comment:4 reviewmylife3 years ago

  • Cc reviewmylife added

comment:5 nacin3 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.

comment:6 ryan3 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.

comment:7 ryan3 years ago

See also #16703

greuben3 years ago

comment:8 greuben3 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

greuben3 years ago

comment:9 nacin3 years ago

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

comment:10 greuben3 years ago

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

comment:11 aaroncampbell3 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?

comment:12 ryan3 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.

greuben3 years ago

comment:13 greuben3 years ago

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

comment:14 follow-up: reviewmylife3 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.

comment:15 in reply to: ↑ 14 ; follow-up: greuben3 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)

comment:16 reviewmylife3 years ago

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

comment:17 in reply to: ↑ 15 ; follow-up: ashfame3 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 3 years ago by ashfame (previous) (diff)

comment:18 in reply to: ↑ 17 ; follow-up: greuben3 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?

comment:19 in reply to: ↑ 18 ashfame3 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?

comment:20 markjaquith3 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

comment:21 markjaquith3 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

comment:22 mskogly3 years ago

  • Version changed from 3.1 to 3.1.3

comment:23 lafayettenuke3 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.