Wordpress + w3tc + nginx enhanced disk caching - error 404 sending as 200


#1

Is there a way to send cached 404 pages with HTML STATUS 404 instead of 200?


#2

Sorry we don't use w3tc's page caching feature.

May be you can switch to nginx's fastcgi_cache - https://rtcamp.com/wordpress-nginx/tutorials/single-site/fastcgi-cache-with-purging/


#3

That's awesome, and I appreciate all of your support Mr. Rahul, you guys have the best website with NGINX coverage and documentation online, and I will back you up completely.

Anyways, so you recommend I turn off w3tc disk enhanced page caching, and use the guide in that URL? Sounds great, but I have two questions regarding it.

Can we purge certain pages on fastcgi_caching or have to purge all pages?

My second question is regarding 404 pages, having 404 caching with disk enhanced caching is a security threat due to creation of files upon every different URL request, so I had to disable 404 caching for that reason. Does fastcgi_caching provide enhanced 404s handling in this regard?


#4

Can we purge certain pages on fastcgi_caching or have to purge all pages?

Yes. Nginx-helper has purge-settings using which you can control what gets purged whenever a post is published/edited.

Does fastcgi_caching provide enhanced 404s handling in this regard?

I am not sure what do you mean by "enhanced handling". You can use fastcgi_cache_valid directive if you want to cache 404 pages. By default 404 are not cached. See: http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_cache_valid


#5