Forum: NGINX RewriteCond %{REQUEST_URI} how to in nginx?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C3ab146b8cf153e371e60a6f288f7188?d=identicon&s=25 Joe Shang (Guest)
on 2008-11-21 23:55
(Received via mailing list)
Sorry if this is a dumb question, but a newb to nginx rewrites, been
trying to convert ALOT of websites over to nginx.

Though this one:

RewriteCond %{REQUEST_URI} !(index\.php|\.css) [NC]

How would this translate to nginx?

Probably doesn't matter?

Joe
561c2fb6d0c72e0c7bc52b263c7d56c3?d=identicon&s=25 Merlin (Guest)
on 2008-11-22 02:21
(Received via mailing list)
That is not a rewrite rule, it is a rewrite condition.  The rule is the
first RewriteRule after the condition.  Without the rule and all the
conditions that apply to it, you won't be able to convert it.
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2008-11-22 09:46
(Received via mailing list)
On Fri, Nov 21, 2008 at 04:48:30PM -0600, Joe Shang wrote:

> Sorry if this is a dumb question, but a newb to nginx rewrites, been
> trying to convert ALOT of websites over to nginx.
>
> Though this one:
>
> RewriteCond %{REQUEST_URI} !(index\.php|\.css) [NC]
>
> How would this translate to nginx?
>
> Probably doesn't matter?

You should inverse RewriteCond logic (making it clear to human):

location / {
    # !/(index\.php|\.css)
    ...
}

location ~ /index\.php$ {
    ...
}

location ~ \.css$ {
    ...
}
This topic is locked and can not be replied to.