Forum: NGINX Optimize rewrite

Posted by Anto (Guest)
on 2013-02-24 22:18
(Received via mailing list)
hello

I have a script that works with apache but I want to migrate to nginx, I
have this rule, but maybe you can do differently optimized.

## HTACCESS
<IfModule mod_rewrite.c>
    RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^(.*)$ index.php?url=$1 [QSA,NC,L]

RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*)$ index.php [QSA,NC,L]

RewriteCond %{REQUEST_FILENAME} -s
RewriteRule ^(.*)$ index.php [QSA,NC,L]
</IfModule>

## NGINX

location / {
        rewrite    ^/(.*)/(.*)$      /$1/index.php?url=$2;
    }

Thanks !!

Regards
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.