Tricky Rewrite rules.

HonDev Developer developerhondev at gmail.com
Mon Nov 19 03:45:15 MSK 2007


By the way I don't think you'll need to  use the gzip component of
wp-super-cache on nginx since nginx already has on the fly gzip.
(compression as I understand it.)



On Nov 19, 2007 11:18 AM, HonDev Developer <developerhondev at gmail.com> wrote:
> I am also keen to get this working although this is above my ability
> unfortunately.  Is there a way to pay Igor for this?
>
>
> On Nov 19, 2007 3:54 AM, Gustavo Barrón <lists at ruby-forum.com> wrote:
> > Hi,
> >
> > I was in need of some advice. I wanted to use a new cache plugin for
> > Wordpress, that writes static files. But I can't setup the rules.
> >
> > The original .htaccess is something like this:
> > -----------------
> > RewriteEngine On
> > RewriteBase /
> > RewriteCond %{QUERY_STRING} !.*s=.*
> > RewriteCond %{HTTP_COOKIE} !^.*comment_author_.*$
> > RewriteCond %{HTTP_COOKIE} !^.*wordpressuser.*$
> > RewriteCond %{HTTP_COOKIE} !^.*wp-postpass_.*$
> > RewriteCond %{HTTP:Accept-Encoding} gzip
> > RewriteCond
> > %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1index.html.gz
> > -f
> > RewriteRule ^(.*)
> > /wp-content/cache/supercache/%{HTTP_HOST}/$1index.html.gz [L]
> >
> > RewriteCond %{QUERY_STRING} !.*s=.*
> > RewriteCond %{HTTP_COOKIE} !^.*comment_author_.*$
> > RewriteCond %{HTTP_COOKIE} !^.*wordpressuser.*$
> > RewriteCond %{HTTP_COOKIE} !^.*wp-postpass_.*$
> > RewriteCond
> > %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1index.html
> > -f
> > RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1index.html
> > [L]
> > -----------------
> >
> > Somehow I ended with this rules...
> >
> > -----------------
> >   location / {
> >     root        /var/www/mydomain.com/htdocs;
> >     index      index.html index.php;
> >
> >     if ($request_uri ~* ".*s=.*") { rewrite ^(.*)$  /index.php$1  break;
> > }
> >     if ($http_cookie ~* "^.*comment_author_.*$" ) { rewrite ^(.*)$
> > /index.php?q=$1 break; }
> >     if ($http_cookie ~* "^.*wordpressuser.*$" ) { rewrite ^(.*)$
> > /index.php?q=$1  break; }
> >     if ($http_cookie ~* "^.*wp-postpass_.*$" ) { rewrite ^(.*)$
> > /index.php?q=$1 break; }
> >     if ($http_cookie ~* "^.*wordpressuser.*$" ) { rewrite ^(.*)$
> > /index.php?q=$1 break; }
> >     if (-f /wp-content/cache/supercache/mydomain.com/$1index.html ) {
> >       rewrite ^(.*)$
> > /wp-content/cache/supercache/mydomain.com/$1index.html last;
> >     }
> >
> >     if (!-e $request_filename) {
> >       rewrite ^(.*)$  /index.php?q=$1  last;
> >     }
> >   }
> >
> > -----------------
> >
> > I ommited the Gzip comprobation, mostly because I couldn't find how to
> > verify the support on the client.
> >
> > Between all my iterations of the config I have encountered many weird
> > stuff, like getting 404's, 500 and sometimes it returns the php directly
> > instead of sending to the fcgi service.
> >
> > Anyway thanks for taking time to get to the bottom of this mail in the
> > sea of mails in the mailing list and thanks in advance for any advise.
> > --
> > Posted via http://www.ruby-forum.com/.
> >
> >
>





More information about the nginx mailing list