WordPress.org

Making WordPress.org

Opened 2 years ago

Closed 2 years ago

Last modified 6 months ago

#2671 closed defect (fixed)

Forums: Archived topics can redirect to another topic

Reported by: SergeyBiryukov Owned by: SergeyBiryukov
Milestone: Priority: normal
Component: Support Forums Keywords:
Cc:

Description

  1. If you're a moderator, log out of the forums or open an Incognito window.
  2. Visit https://wordpress.org/support/topic/help-me-75/ (an archived topic)
  3. It redirects to https://wordpress.org/support/topic/help-me-63/, which shouldn't happen.

Change History (9)

#1 @SergeyBiryukov
2 years ago

  • Summary changed from Forums: Archived topics can redirect to an other topic to Forums: Archived topics can redirect to another topic

This ticket was mentioned in Slack in #forums by sergey. View the logs.


2 years ago

#3 follow-up: @netweb
2 years ago

This is WordPress automatically redirecting to the nearest matching slug of a published post...

To prevent this I think this is all that'd would be needed, but would want to do some testing with other post statuses:

remove_filter('template_redirect', 'redirect_canonical');

#4 @SergeyBiryukov
2 years ago

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

In 5280:

Support Forums: Disable redirect_guess_404_permalink() for hidden topics.

This prevents Spam, Pending, or Archived topics that the current user cannot view from performing a redirect to other unrelated topics.

Fixes #2671.

#5 in reply to: ↑ 3 @SergeyBiryukov
2 years ago

Replying to netweb:

This is WordPress automatically redirecting to the nearest matching slug of a published post...

Right. Disabling redirect_canonical() altogether seemed like an overkill, went with a more targeted fix in [5280] :)

#6 @SergeyBiryukov
2 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Still seeing the redirect, apparently [5280] didn't work as expected.

Works fine on my local install though (just tested again), might be something dotorg-specific. I guess this will have to wait until someone with a sandbox can take a look.

#7 @netweb
2 years ago

The code in [5280] is checking the topic for conditional is_404(), as shown in curl here it shows a 301 redirect from https://wordpress.org/support/topic/help-me-75/ to https://wordpress.org/support/topic/help-me-63/

curl -I https://wordpress.org/support/topic/help-me-75/
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Fri, 21 Apr 2017 22:35:25 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Strict-Transport-Security: max-age=360
X-Olaf: ⛄
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Cache-Control: no-cache, must-revalidate, max-age=0
Location: https://wordpress.org/support/topic/help-me-63/
X-Frame-Options: SAMEORIGIN
X-nc: MISS lax 249

Thinking bbPress might need some additional support for custom statuses here :thinking:

#8 @SergeyBiryukov
2 years ago

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

No longer seeing the redirect, re-closing as fixed. I'd blame caching :)

#9 @SergeyBiryukov
6 months ago

In 8229:

Support Forums: Disable wp_old_slug_redirect() for hidden topics to avoid a redirect loop.

H/t joostdevalk.
See #2671.

Note: See TracTickets for help on using tickets.