Thanks for the explanation. Sorry, not able to understand you fully. My PCRE is something like this (have tested it through https://regex101.com/) .+\..{3}(?P<route>.{6})[^\.]*$ Now, to achieve this what should I put in the nginx.conf Please let me know. Posted at Nginx Forum: http://forum.nginx.org/read.php?2,258636,258646#msg-258646