Nginx skip WordPress 404 handling for static files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (-f $request_filename) { | |
break; | |
} | |
if (-d $request_filename) { | |
break; | |
} | |
if ($request_uri ~ "(robots\.txt|sitemap\.xml(\.gz)?)") { | |
break; | |
} | |
if ($request_uri ~* \.(css|js|html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|swf|tar|tif|tiff|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$) { | |
return 404; |
Into the NGINX configuration file.
Hi,
this should be a location directive in Nginx?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Where does this code go to work?