• Resolved Nikolai Lusan

    (@niolai-lusan)


    We are using WP 4.7.2 with woocomerce and w3 total cache 0.9.5.2 on nginx – all configuration is inline with the codex (https://codex.www.ads-software.com/Nginx),

    We have a situation where a single permalink for a subsection is returning a 404 error directly from nginx – other permalinks in the same category are being processed properly, and creating a random URI under the category returns to WP 404 page.

    For example a valid resource permalink “https://<domain>/store/pdf-resources/resource-1&#8221; returns the page it’s supposed to. A random resource “https://<domain>/store/pdf-resources/resource-foo&#8221; returns the WP instances pretty 404 page. One single permalink (out of some 250+) “https://<domain>/store/pdf-resources/resource-estevanico&#8221; returns the nginx 404.

    Extensive debugging of the the rewrite rules and nginx config shows that (as configured) resources in this class are not to be cached by W3TC – it matches the rule to set the “null cache”, and a negative match for logged in users and /wp-admin access (which even if it matched would set “null cache”). The very next line in the nginx log is an open() on /<webroot>/store/pdf-resources/resource-estevanico – which seems odd to say they least.

    This particular resource has been re-created from scratch more than once, each time with a different permalink, each time with the same result.

    Can anyone shed light on why one single resource like this is not being addressed properly?

    Is there a way to get WP to show it has received the request?

Viewing 2 replies - 1 through 2 (of 2 total)
  • It is indeed strange to know that nginx works differently for the term “estevanico”. Probably, you may run grep -inr ico * insider /etc/nginx/ directory (or where the nginx configs resides) and post the relevant output here.

    It would be helpful, if you also attach the debug log (removing domain info among others) for the following requests…

    – the particular request that gets 404 on nginx
    – any random request that gets passed to WP and still gets 404

    Btw, https://codex.www.ads-software.com/Nginx doesn’t use the best practices. For example, inside if statement only two statements are 100% safe to include…

    1. return statement
    2. rewrite … last statement.

    Obviously, everywhere we see “set” inside if. While, it works for most, it brings anamolies.

    Thread Starter Nikolai Lusan

    (@niolai-lusan)

    You were exactly right. One of the location regexes for W3TC had been altered and was missing a backslash. This caused the permalink to be passed through as if it was a request for a file.

    Thanks for the tip.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Single permalink returning a server (not WP) 404’ is closed to new replies.