Opened 10 years ago
Closed 9 years ago
#29858 closed defect (bug) (duplicate)
Permalinks not redirecting from various types to setting value
Reported by: | gmisura | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.0 |
Component: | Canonical | Keywords: | |
Focuses: | Cc: |
Description
On a fresh install of WordPress4.0, I changed the permalink structure to "Day and Name" (i.e. yyyy/mm/dd/sample-post). If you go to /sample-post/ you are redirected to yyyy/mm/dd/sample-post (expected).
However, if you change the permalink structure to "Post Name" and you request the url: 2014/10/03/hello-world/ you are not redirected to /hello-world/ you get a 404 error.
I'd hope that is not intentional, and that this is a bug that can be fixed.
Looks like this extends to other settings:
Some additional testing shows there's a few more bugs:
permalink | ?p=1 | /yyyy/mm/dd/hello-world/ | /yyyy/mm/hello-world/ | /archives/1/ | /hello-world/ |
---|---|---|---|---|---|
default | HTTP 200 | HTTP 200 | HTTP 200 | HTTP 200 | HTTP 200 |
Day & Name | HTTP 301 | HTTP 200 | HTTP 301 | HTTP 404* | HTTP 301 |
Month & Name | HTTP 301 | HTTP 301 | HTTP 200 | HTTP 404* | HTTP 301 |
Numeric | HTTP 301 | HTTP 301 | HTTP 301 | HTTP 200 | HTTP 301 |
Post name | HTTP 301 | HTTP 404* | HTTP 404* | HTTP 404* | HTTP 200 |
(The first column is the setting in wordpress, the top row is the requested URL).
I would expect HTTP 301 for all of the HTTP 404*'s
I poked around the code (though debugging at midnight with a 6am alarm is not smart) and putting in debugging statements, came to what I believe is a problem in query not recognizing the postname in the URL when it comes after dd. If I add ?name=hello-world, things start to act better (i.e. permalink setting: post Name, /yyyy/mm/dd/hello-world/?name=hello-world returns 301 and I get sent to /hello-world as expected).
My goal is to change a long existing blog from Day & name to Post name. For SEO reasons, /post-name should be canonical and all other links should redirect to it.
@markjaquith and @dd32 - Could one of you triage this and see how much work it would take to ensure we redirect correctly here?