Support » Plugin: Better WordPress Minify » Resource interpreted as Stylesheet but transferred with MIME type text/html

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Khang Minh

    (@oddoneout)

    What do you see when you visit http://ask.fitforlife.fr/cache/minify-b1-bootstrap-0f8daac43b4dc6a234767952b48b7f8c.css ? If it’s an HTML page, my guess is something on the server is messing with this particular file/url pattern.

    Hey,
    so I re-enabled it back and I’ve noticed that I have some cached files in the “cache” directory, but the CSS don’t get created.
    It’s strange.
    I’ve been able to flush the cache (all files were removed), but upon refresh, they don’t get rerecreated.
    Chmod is 755

    ha!
    It was related to the option “Enable friendly Minify urls”
    When I turn it off, the files are now properly created.
    Perhaps a bug here, same problem as here it looks like:
    https://wordpress.org/support/topic/bwm-and-wp-engine-compatibility?replies=8

    I checked, and the rules have been created int the .htaccess filee

    Plugin Author Khang Minh

    (@oddoneout)

    Are you using nginx for anything? If not you’re probably having a different issue. Are you using WordPress multisite and you’re on a subdomain?

    Can you try changing the cache directory to wp-content/cache/minify? In fact any folder under wp-content is ok. And of course, please re-enable “friendly minify url” to check.

    If you can post your .htaccess file’s contents here that would be great. Thanks.

    I’m using the Litespeed web server.
    No nginx around 🙂

    It’s a regular installation.

    It’s working when it’s the default directory 😀

    Here’s the .htaccess from the default cache directory:

    # BEGIN BWP Minify Rules
    # BEGIN BWP Minify Headers
    <Files "*.js.gz">
    ForceType application/x-javascript
    </Files>
    <Files "*.css.gz">
    ForceType text/css
    </Files>
    <IfModule mod_mime.c>
    AddEncoding gzip .gz
    AddCharset utf-8 .js .css
    </IfModule>
    <IfModule mod_deflate.c>
        <IfModule mod_setenvif.c>
        SetEnvIfNoCase Request_URI "\.gz$" no-gzip
        </IfModule>
    </IfModule>
    <IfModule mod_headers.c>
    Header set Cache-Control "public, max-age=86400"
    Header set Vary "Accept-Encoding"
    Header unset ETag
    </IfModule>
    # END BWP Minify Headers
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteRule .* - [E=ZIP_EXT:.gz]
    RewriteCond %{HTTP:Cache-Control} !no-cache
    RewriteCond %{HTTP:If-Modified-Since} !no-cache
    RewriteCond %{REQUEST_FILENAME}%{ENV:ZIP_EXT} -f
    RewriteRule (.*) $1%{ENV:ZIP_EXT} [L]
    RewriteRule ^minify-b(\d+)-([a-zA-Z0-9-_.]+)\.(css|js)$ /index.php?blog=$1&min_group=$2&min_type=$3 [L]
    </IfModule>
    # END BWP Minify Rules
    <Limit POST PUT DELETE>
    Order Allow,Deny
    Deny from All
    </Limit>

    And the one from the other directory:

    # BEGIN BWP Minify Rules
    # BEGIN BWP Minify Headers
    <Files "*.js.gz">
    ForceType application/x-javascript
    </Files>
    <Files "*.css.gz">
    ForceType text/css
    </Files>
    <IfModule mod_mime.c>
    AddEncoding gzip .gz
    AddCharset utf-8 .js .css
    </IfModule>
    <IfModule mod_deflate.c>
        <IfModule mod_setenvif.c>
        SetEnvIfNoCase Request_URI "\.gz$" no-gzip
        </IfModule>
    </IfModule>
    <IfModule mod_headers.c>
    Header set Cache-Control "public, max-age=86400"
    Header set Vary "Accept-Encoding"
    Header unset ETag
    </IfModule>
    # END BWP Minify Headers
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteRule .* - [E=ZIP_EXT:.gz]
    RewriteCond %{HTTP:Cache-Control} !no-cache
    RewriteCond %{HTTP:If-Modified-Since} !no-cache
    RewriteCond %{REQUEST_FILENAME}%{ENV:ZIP_EXT} -f
    RewriteRule (.*) $1%{ENV:ZIP_EXT} [L]
    RewriteRule ^minify-b(\d+)-([a-zA-Z0-9-_.]+)\.(css|js)$ /index.php?blog=$1&min_group=$2&min_type=$3 [L]
    </IfModule>
    # END BWP Minify Rules

    Plugin Author Khang Minh

    (@oddoneout)

    Hmm all look good to me. What is in your main .htaccess file (i.e. the one in the root of WordPress?)

    Here is the root .htaccess:

    #RAZ 09302015
    <FilesMatch "(\.css)$">
        AddType text/css .css
        Header set Content-Type text/css
    </FilesMatch>
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule .* - [E=noabort:1]
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    <IfModule mod_headers.c>
    	Header set Access-Control-Allow-Origin "*"
    </IfModule>
    
    <IfModule deflate_module>
        <IfModule filter_module>
            AddOutputFilterByType DEFLATE text/plain text/html
            AddOutputFilterByType DEFLATE text/xml application/xml application/xhtml+xml application/xml-dtd
            AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml image/svg+xml
            AddOutputFilterByType DEFLATE text/css text/javascript application/javascript application/x-javascript
            AddOutputFilterByType DEFLATE font/otf font/opentype application/font-otf application/x-font-otf
            AddOutputFilterByType DEFLATE font/ttf font/truetype application/font-ttf application/x-font-ttf
        </IfModule>
    </IfModule>

    Thanks!

    Plugin Author Khang Minh

    (@oddoneout)

    OK can you try each of the following and then reenable the friendly minify feature:

    1. Comment out this section:

    <FilesMatch "(\.css)$">
        AddType text/css .css
        Header set Content-Type text/css
    </FilesMatch>
    

    2. Comment out this line:

    AddOutputFilterByType DEFLATE text/css text/javascript application/javascript application/x-javascript
    

    Hi,
    I tried the two suggestions, but it didn’t change anything.
    Actually, when I refreshed, I still had the CSS missing, despite the fact that it was the default cache directory, this is really weird.

    Plugin Author Khang Minh

    (@oddoneout)

    OK, let’s take this one step further. Can you contact me via http://betterwp.net/contact/ ?

    cjhaas

    (@chrisvendiadvertisingcom)

    I just wanted to add that I was experiencing this as well. In my case I inherited a site and BWP Minify is one of the plugins that I always install, not only for the minification and merging but also to find broken CSS.

    It turns out someone wrote this wonderful bit of code below, I’m guessing to try and disable a background image:

    background: url('') ;

    The CSS _processUriCB function was choking on it on line 288 (I don’t blame it). I fixed my CSS but if for some reasons someone wanted to change this they could simply change line 286 from:

    if ('/' !== $uri[0]

    to

    if ($uri && '/' !== $uri[0]

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Resource interpreted as Stylesheet but transferred with MIME type text/html’ is closed to new replies.