#47814 closed defect (bug) (invalid)
404's redirect to the front page
Reported by: | Owned by: | ||
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 5.2.2 |
Component: | Permalinks | Keywords: | |
Focuses: | Cc: |
Description (last modified by )
When there is a permalink "custom structure", 404's not within this structure redirect to the home page. Within the structure they work fine. Tested with twentynineteen theme, all plugins deactivated, and bare bones nginx config downloaded from nginx.org. The same scenario seems to work fine with Apache.
Examples:
$ curl -I -L https://www.kentuckybred.org/xyz HTTP/1.1 301 Moved Permanently Server: nginx Date: Wed, 31 Jul 2019 20:26:50 GMT Content-Type: text/html; charset=UTF-8 Connection: keep-alive Vary: Accept-Encoding, Cookie X-Pingback: https://www.kentuckybred.org/xmlrpc.php X-Redirect-By: WordPress Location: https://www.kentuckybred.org/ X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block X-Content-Type-Options: nosniff X-Permitted-Cross-Domain-Policies: master-only Strict-Transport-Security: max-age=31536000;includeSubdomains $ curl -I -L https://www.kentuckybred.org/resources/news/xyz HTTP/1.1 404 Not Found Server: nginx Date: Wed, 31 Jul 2019 20:27:02 GMT Content-Type: text/html; charset=UTF-8 Connection: keep-alive Vary: Accept-Encoding Vary: Accept-Encoding, Cookie Expires: Wed, 11 Jan 1984 05:00:00 GMT Cache-Control: no-cache, must-revalidate, max-age=0 Link: <https://www.kentuckybred.org/wp-json/>; rel="https://api.w.org/"
Footnote: This site is not public yet, but scheduled for tomorrow launch.
Change History (6)
#3
@
5 years ago
'News' is not a category, so the structure is: /resources/news/%postname%. Was your test with nginx? That seems necessary. I have another site with the same behavior, with the structure of just /blog/. On that one I didn't have an easy way to change themes, turn off plugins, etc. so not tested as thoroughly.
#4
@
5 years ago
It seems the way nginx was handling
$_SERVER['PHP_SELF']
in this installation is the root cause. I'll provide more detail after a little more testing to make sure this is indeed the cause. Thx.
#5
@
5 years ago
- Resolution set to invalid
- Status changed from new to closed
$_SERVER['PHP_SELF']
was being set to the pretty permalink, which apparently is a no-no. Similar scenario to https://core.trac.wordpress.org/ticket/34634. Fixed by reconfiguring nginx per WP specs (not exactly sure which specific setting it was).
Hi @halburgissnet, welcome to WordPress Trac! Thanks for the report.
To clarify, the custom permalink structure in your case is
/resources/%category%/%postname%
, is that correct?I could not reproduce the issue so far, requesting a
/xyz
URL on a clean install shows the 404 error as expected for me.