I have problems with nginx to get the .php index files to to friendly urls.

for example my apache setup thats working perfect:

```
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^([a-z]+)/([a-z\-]+)$ /$1/$2.php [L]
</IfModule>

RewriteBase /
RewriteCond %{HTTP_HOST} !^http://domain.local$ [NC]
RewriteRule ^(.*)$ http://domain.local$1 [L,R=301]
RewriteRule ^start index.php [L]
RewriteRule ^side2 side2.php [L]
RewriteRule ^side3 side3.php [L]
RewriteRule ^side4 side4.php [L]
RewriteRule ^side5 side5.php  [L]
RewriteRule ^side6 side6.php [L]

```

But if i try to convert them to nginx there is no way for me to just get it to work. I have search a bit but nothing found.

this is what i have try

```
location / {
rewrite ^/([a-z]+)/([a-z\-]+)$ /$1/$2.php break;
if ($http_host !~ "^domain.local$"){
rewrite ^(.*)$ http://domain.local/$1 redirect;
}
}
location /start {
rewrite ^/start /index.php break;
}
location /side1 {
rewrite ^/side1 /pages/side1/side1.php break;
}
location /side2 {
rewrite ^/side2 /pages/side2.php break;
}
location /side3 {
rewrite ^/side3 /pages/side3.php break;
}
location /side4 {
rewrite ^/side4 /pages/side4.php break;
}
location /side5 {
rewrite ^/side5 /pages/side6.php break;
}
location /side6 {
rewrite ^/side6 /form.php break;
}

```

I get it worked by my self.

```
 rewrite ^/([a-z]+)/([a-z-]+)$ /$1/$2.php last;
 if ($http_host !~* "^domain.local$"){
 set $rule_1 1$rule_1;
 }
 if ($rule_1 = "1"){
rewrite ^/(.*)$ http://domain.local/$1 permanent;
}
rewrite ^/start /index.php last;
rewrite ^/side1 /pages/side1/side1.php last;
rewrite ^/side2 /pages/side2.php last;
rewrite ^/side3 /pages/side3.php last;
rewrite ^/side4 / pages/side4.php last;
rewrite ^/side5 /pages/side5.php last;
rewrite ^/side6 /form.php last;

```