• Just checked the Yoast SEO plugin and it was returning a 404 status code in the sitemap xml file (even though the sitemap was fine). W3C Total Cache came out to be the culprit. Removing the following lines from .htaccess fixed it.

    # BEGIN W3TC Skip 404 error handling by WordPress for static files
    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_URI} !(robots\.txt|sitemap\.xml(\.gz)?)
        RewriteCond %{REQUEST_FILENAME} \.(css|js|htc|html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ [NC]
        RewriteRule .* - [L]
    </IfModule>
    # END W3TC Skip 404 error handling by WordPress for static files
  • The topic ‘Yoast Sitemap returns 404 in header’ is closed to new replies.