WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
W3TC .htaccess code for static does not always work? (2 posts)

  1. cycon
    Member
    Posted 1 year ago #

    Hello, i have a W3TC .htaccess code here:

    # BEGIN W3TC Skip 404 error handling by WordPress for static files
    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteCond %{REQUEST_URI} !(robots\.txt|sitemap\.xml(\.gz)?)
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} \.(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)$ [NC]
        RewriteRule .* - [L]
    </IfModule>
    # END W3TC Skip 404 error handling by WordPress for static files

    This code asks Apache directly handle non-existent files with listed above extensions, not trowing them to following WordPress processing, correct?
    In my case I have a "ErrorDocument 404 /404.html" directive above W3TC directives and everything is great for requests like /abracadabra.gif or /wp-content/upload/abracadabra.gif.

    But if directory does not acrually exist like /wp-content/upload/someun-esisting-dir/abracadabra.gif - this request is being handled by WordPress.

    So, if directory for requested file does not exists, above W3TC directives does not work. And this is common 404 situation.

    To make it clear: I'm trying to forward all 404 responses to static file.

    Could not google anything on this. Any suggestions?

    http://wordpress.org/extend/plugins/w3-total-cache/

  2. Frederick Townes
    Member
    Plugin Author

    Posted 1 year ago #

    So why don't you use the ErrorDocument directive?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic