Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#47814 closed defect (bug) (invalid)

404's redirect to the front page

Reported by: halburgissnet's profile 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 The same scenario seems to work fine with Apache.


$ curl -I -L
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-Redirect-By: WordPress
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
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: <>; rel=""

Footnote: This site is not public yet, but scheduled for tomorrow launch.

Change History (6)

#1 @SergeyBiryukov
5 years ago

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

#2 @SergeyBiryukov
5 years 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@…
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 @hal@…
5 years 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 5 years ago by hal@… (previous) (diff)

#5 @hal@…
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 Fixed by reconfiguring nginx per WP specs (not exactly sure which specific setting it was).

#6 @desrosj
5 years ago

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