• Resolved Henry ávila

    (@henryavila)


    Hi, after enabling css and js minifi and compress, the site return an 404 error on “/min/xxxx.css” and “/min/xxxx.js”,

    I undestand that it’s because the plugin create an .httaccess rewrite rule, but I’m using nginx.

    So, how can I use nginx? Is there an rewrite rule to nginx?

    • This topic was modified 6 years, 4 months ago by Henry ávila.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support qtwrk

    (@qtwrk)

    Hi,

    Please convert following rule into nginx sytle.

    htaccess:

    RewriteEngine on
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} ^(.*)/min/(\w+)\.(css|js)$
    RewriteCond %1/wp-content/cache/$2/$1.$2 -f
    RewriteRule min/(\w+)\.(css|js) wp-content/cache/$2/$1.$2 [L]

    nginx:

    location / {
      rewrite min/(\w+)\.(css|js) /wp-content/cache/$2/$1.$2 break;
    }

    nginx rule converted by Googling , untested , please adjust it if needed.

    Best regards,

    Thread Starter Henry ávila

    (@henryavila)

    Hi, the provided code don’t work, but I chaged it and it’s now working.

    The working code for nginx 1.12.2 is

            location ~ \.(css|js)$ {
                rewrite ^/min/(.*)\.(css|js)$ /wp-content/cache/$2/$1.$2 last;
            }
    

    Thanks for the help!

    • This reply was modified 6 years, 4 months ago by Henry ávila.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘minified js and css don’t work on nginx’ is closed to new replies.