wordpressopencartsitemap.xml

Is OpenCart or WordPress responding with 404 error for /blog/sitemap-misc.xml?


I am using OpenCart v.1.5.6.5_rc for an e-Shop and WordPress v.4.1 for the e-Shop's blog.

I am a little bit confused on which of the two is responding with a 404 error for the blog's sitemap-misc.xml which is generated from the WordPress plugin Google XML Sitemaps (https://wordpress.org/plugins/google-sitemap-generator/).
Before using this plugin, I was using WordPress SEO by Yoast (https://wordpress.org/plugins/wordpress-seo/) to generated the sitemap xml (for the blog) and I thought that was causing the 404 error, but it wasn't!

My structure is

-admin  
-blog/sitemap.xml (/blog/sitemap-misc.xml, /blog/sitemap-tax-post_tag.xml, /blog/sitemap-pt-post-2015-01.xml etc)  
-catalog  
-download  
-image  
-system  
-vqmod  
sitemap.xml (OpenCart: Extensions -> Product Feeds) - works fine 

What confuses me more is that the /blog/sitemap.xml works, but the analysis of the /blog/sitemap.xml

-blog/sitemap.xml  
      sitemap-misc.xml  
      sitemap-tax-post_tag.xml  
      sitemap-pt-post-2015-01.xml  

fails with a General HTTP error: 404 not found!

Actually, if I use the full path on my browser http://www.example.com/blog/sitemap-misc.xml, OpenCart respondes with a 404 error.

Any help is appreciated.

Thank you!


Solution

  • My problem was not caused either by OpenCart or WordPress (core).

    The W3 Total Cache (https://wordpress.org/plugins/w3-total-cache/) WordPress plugin that I am using was causing the 404 errors!

    I had checked the option in Performance -> Browser Cache

    Do not process 404 errors for static objects with WordPress.
    Reduce server load by allowing the web server to handle 404 (not found) errors for static files (images etc).
    If enabled - you may get 404 File Not Found response for some files generated on-the-fly by WordPress plugins. You may add those file URIs to 404 error exception list below to avoid that.

    # 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(_index)?\.xml(\.gz)?|[a-z0-9_\-]+-sitemap([0-9]+)?\.xml(\.gz)?)
        RewriteCond %{REQUEST_FILENAME} \.(css|htc|less|js|js2|js3|js4|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|json|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|woff|xla|xls|xlsx|xlt|xlw|zip)$ [NC]
        RewriteRule .* - [L]
    </IfModule>
    # END W3TC Skip 404 error handling by WordPress for static files
    

    So, when I unchecked that option my problem was resolved!

    I guess I could just remove this line
    RewriteCond %{REQUEST_URI} !(robots\.txt|sitemap(_index)?\.xml(\.gz)?|[a-z0-9_\-]+-sitemap([0-9]+)?\.xml(\.gz)?)
    from the /blog/.htaccess file to reduce server load.