mercredi 29 avril 2015

Nginx rewrite doesn't work when I try to match a file

I need to convert in Nginx these .htaccess rules, but when I try to target the filename and its extensions, Nginx doesn't match it. I really don't understand why of this behavior.

RewriteRule ^(.*?)(test_mod_rewrite) /$1media/plg_jchoptimize/assets/modrewrite.php?q=$2
RewriteRule ^(.*?)(gz|nz)/([^/]+)/([^/]+)/([^/]+)\.(js|css)$  /$1media/plg_jchoptimize/assets/jscss.php?f=$5&type=$6&gz=$2&d=$3&i=$4

I converted these rules in Nginx:

location /media/plg_jchoptimize/assets/ {
    rewrite ^/(test_mod_rewrite) /media/plg_jchoptimize/assets/modrewrite.php?q=$1;
    rewrite ^/(gz|nz)/([^/]+)/([^/]+)/([^/]+)\.(js|css) $/$1media/plg_jchoptimize/assets/jscss.php?f=$4&type=$5&gz=$1&d=$2&i=$3;
}

The example URL is:

/media/plg_jchoptimize/assets/gz/30/0/d8604b25d503f1dcbb035ec731857648.css

What I'm wrong?

Aucun commentaire:

Enregistrer un commentaire