Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#29598 closed defect (bug) (duplicate)

Use a 404 page not found instead of redirecting

Reported by: henry.wright Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.0
Component: Canonical Keywords:
Focuses: Cc:


I have my permalinks set to post ID so I can access my posts like:

  • example.com/625/
  • example.com/76/

The title of one of my posts is "Post of the year award". I can access this particular post like:

  • example.com/118/

The problem:

If a user types the URL example.com/post/, they seem to be redirected to "Post of the year award" example.com/118/.

Likewise, if a user types URL example.com/baseball/, they seem to be redirected to "Baseball is for everyone" example.com/128/.

As you can see this behaviour is not really helpful in my case. The user ends up viewing a post they might not necessarily want to be viewing.

I propose that 404 Not found pages be used instead of the redirects.

Change History (2)

#1 @SergeyBiryukov
7 years ago

  • Component changed from General to Canonical
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #16557. Try a workaround from there:

function remove_redirect_guess_404_permalink( $redirect_url ) {
	if ( is_404() )
		return false;
	return $redirect_url;
add_filter( 'redirect_canonical', 'remove_redirect_guess_404_permalink' );

This ticket was mentioned in IRC in #wordpress-dev by nacin. View the logs.

7 years ago

Note: See TracTickets for help on using tickets.