rewrite question - "(css/js).php" to "(.css/.js)"

voku nginx-forum at nginx.us
Sun Oct 24 06:30:41 MSD 2010


Hi, I want to speed up my WordPress-Blog and so I want to cache
"css.php", "js.php" files to ".css", ".js"

for example I want to rewrite ... this ->

http://suckup.de/wp-content/plugins/wp-special-textboxes/css/wp-special-textboxes.css.php?ver=3.0.1

to...

http://suckup.de/wp-content/cache/wp-special-textboxes.css

-----------------------

I had experiment with this rule...

        [code]
## Optimierung - "(css/js).php" to "(css/js)"
        location /wp-content/plugins/wp-special-textboxes/css/ {
                if ($args ~ "ver=(.*)") {
                        rewrite ^/?(.*)
$scheme://$host/wp-content/cache/wp-special-textboxes.css permanent;
                }
        }
        location /wp-content/plugins/wp-special-textboxes/js/ {
                if ($args ~ "ver=(.*)") {
                        rewrite ^/?(.*)
$scheme://$host/wp-content/cache/wstb.js permanent;
                }
        }
[/code]

but this only rewrite 

http://suckup.de/wp-content/plugins/wp-special-textboxes/css/?ver=3.0.1

to....

http://suckup.de/wp-content/cache/wp-special-textboxes.css?ver=3.0.1

-----------------------

Can someone please help me, thx! :-)


I have a second problem with the rewrite... I use varnish on port 80 and
nginx on port 8080, but some files from my WordPress-Theme want to use
something like this "@import
"http://suckup.de:8080/blog/2010/07/26/webseiten-analyse/?mystique=css"
...
... can someone say me how to rewrite the port to 80, thx!?!?  :-)


Mfg
Voku

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,143927,143927#msg-143927




More information about the nginx mailing list