Can anyone help me with this? 

```
RewriteCond %{REQUEST_URI} !^\/index\.php$
RewriteCond %{REQUEST_URI} !^\/search\/.*
RewriteCond %{REQUEST_URI} ^\/([^/]*)\.php$
RewriteRule (.*) http://www.mydomain.com/index.php?page=$1

```

I need to convert this for nginx

I tried this, but it won't work:

```
if ($request_uri ~* !^\/search\/.*) {
  if ($request_uri ~* !^\/index\.php$) {
    if ($request_uri ~* ^\/([^/]*)\.php$) {
      rewrite (.*) http://www.mydomain.com/index.php?page=$1;
    }
  }
}

```