Make WordPress Core

Opened 15 years ago

Closed 15 years ago

Last modified 10 years ago

#13125 closed defect (bug) (fixed)

?p=xxx no longer redirects to ?page_id=xxx for Pages

Reported by: ryan's profile ryan Owned by: markjaquith's profile markjaquith
Milestone: 3.0 Priority: normal
Severity: blocker Version: 3.0
Component: Canonical Keywords:
Focuses: Cc:

Description

WP 2.9 redirects ?p= requests for pages to a ?page_id request. 3.0 issues a 404 instead.

Attachments (3)

13125.patch (1.0 KB) - added by solarissmoke 15 years ago.
Redirect p=NNN requests to page_id=NNN when a page with that ID exists
13125-2.patch (960 bytes) - added by night815 15 years ago.
small format changes to adhere to the coding standards
13125-3.patch (1003 bytes) - added by solarissmoke 15 years ago.
Don't attempt to redirect to revisions

Download all attachments as: .zip

Change History (16)

#1 @ryan
15 years ago

demetris tracked this down to [13315], which looks to have done this purposefully. I think a canonical redirect would be nice here.

#2 @solarissmoke
15 years ago

  • Keywords has-patch added

How does this patch look? It works for me, both with/without pretty permalinks enabled.

@solarissmoke
15 years ago

Redirect p=NNN requests to page_id=NNN when a page with that ID exists

@night815
15 years ago

small format changes to adhere to the coding standards

#3 @night815
15 years ago

  • Keywords tested added

I added a new patch that change "if(" to "if (". I did notice that your patch seemed to add an extra line at the end of the file. my patch doesn't even though it's still in my file. Is this because the trunk was already updated with that change?

anyways, I also tested this patch and it works.

#4 @nacin
15 years ago

The line at the end of the file is just line endings. It gets cleaned up upon commit.

#5 @dd32
15 years ago

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

(In [14355]) Serve a canonical redirection for ?p=, ?page_id=, ?attachment_id= url's for incorrect post_types (ie. ?p=<page_id> will redirect to that page url). Fixes #13125

#6 @dd32
15 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Needs some more changes here, Specifically, ?p=<revision_ID> will attempt a redirect to invalid url's (Or at least, url's that the user should not see):
{{
?p=5 redirects to http://localhost/wordpress-commit/index.php/blog/2010/05/3-revision/
}}}

@solarissmoke
15 years ago

Don't attempt to redirect to revisions

#7 @solarissmoke
15 years ago

Patch to check for revisions - although:

Are post revisions ever meant to be directly accessible? (the only way I can currently find to access them is through the diff viewer). If not, then link-template.php could be modified to check for this along with drafts/auto-drafts/pending:

Line 117

if ( '' != $permalink && !in_array($post->post_status, array('draft', 'pending', 'auto-draft')) && 'revision' != $post->post_type )

#8 @nacin
15 years ago

Those post_status checks should instead use get_post_stati.

#9 @ryan
15 years ago

  • Severity changed from normal to blocker

#10 @ryan
15 years ago

(In [14595]) Attempt canonical redirect only for public post types. Props solarissmoke. see #13125

#11 @ryan
15 years ago

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

Good enough? Reopen if there's more that needs to be done.

#12 @me_bruch
10 years ago

  • Keywords needs-patch added; has-patch tested removed

This is a regression now as of version 4.3

#13 @knutsp
10 years ago

  • Keywords needs-patch removed

This ticket was closed on a completed milestone.
If you have a bug or enhancement to report, please open a new ticket. Be sure to mention this ticket, #13125.

Note: See TracTickets for help on using tickets.