Make WordPress Core

Opened 21 months ago

Closed 20 months ago

Last modified 20 months ago

#47814 closed defect (bug) (invalid)

404's redirect to the front page

Reported by: hal@… Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.2.2
Component: Permalinks Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

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.


$ 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)

#1 @SergeyBiryukov
21 months ago

  • Component changed from General to Permalinks
  • Description modified (diff)

#2 @SergeyBiryukov
21 months ago

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.

#3 @hal@…
21 months 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 @hal@…
20 months ago

It seems the way nginx was handling


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.

Last edited 20 months ago by hal@… (previous) (diff)

#5 @hal@…
20 months 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).

#6 @desrosj
20 months ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.