1

Is it possible in Nginx to rewrite URL like this?

http://www.example.com/city/person/contact.php?id=name

to

http://www.example.com/city/person/name/contact
user6834389
  • 73
  • 1
  • 11
  • 2
    Possible duplicate of [How to write a url rewrite in nginx?](http://stackoverflow.com/questions/4329316/how-to-write-a-url-rewrite-in-nginx) – Vasil Rashkov Jan 12 '17 at 10:10

1 Answers1

1

How about:

location ~ /city/person/(.*)/(.*) {
    rewrite ^/city/person/$2.php?id=$1 last;
}
Faisal Memon
  • 1,047
  • 7
  • 7