<div dir="ltr"><div dir="ltr">Ok, this worked :<input name="virtru-metadata" type="hidden" value="{"email-policy":{"state":"closed","expirationUnit":"days","disableCopyPaste":false,"disablePrint":false,"disableForwarding":false,"enableNoauth":false,"expires":false,"isManaged":false},"attachments":{},"compose-id":"3","compose-window":{"secure":false}}"><div><br></div><div><div>rewrite ^/videos/([0-9]+)/(.*)/(.*)/(.*)/([0-9]+)? <a href="https://domain.com/videos/$1/$2">https://domain.com/videos/$1/$2</a> last;<br><br>However, if there's any better rule, please let me know.</div></div><div><br></div><div>Regards.</div><div><br></div></div><br><div class="gmail_quote" style=""><div dir="ltr">On Wed, Dec 12, 2018 at 3:01 PM shahzaib mushtaq <<a href="mailto:shahzaib.cb@gmail.com">shahzaib.cb@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<br><br>Need help on constructing the rewrite url in nginx, need to remove last two parts of uri as stated in example below:<br><br><a href="https://domain.com/videos/32/cooking/most_recent/last_year/" target="_blank">https://domain.com/videos/32/cooking/most_recent/last_year/</a><br>to<br><a href="https://domain.com/videos/32/cooking" target="_blank">https://domain.com/videos/32/cooking</a><br><br><br><a href="https://domain.com/videos/17/tv-showbiz/most_recent/today/" target="_blank">https://domain.com/videos/17/tv-showbiz/most_recent/today/</a><br>to<br><a href="https://domain.com/videos/17/tv-showbiz" target="_blank">https://domain.com/videos/17/tv-showbiz</a><br><br>Actually we need to match uri as below, help will be highly appreciated :<br><br><span style="box-sizing:border-box;margin:0px;padding:0px;vertical-align:baseline;border:0px solid;font-size:14px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI","Segoe UI Emoji","Segoe UI Symbol","Meiryo UI""><code class="gmail-m_1333669644832560329gmail-code-colors gmail-m_1333669644832560329gmail-inline" style="box-sizing:border-box;margin:0px 0.1em;padding:0px 0.5em;vertical-align:middle;border:1px solid rgb(204,204,204);font-size:13px;display:inline;white-space:pre-wrap;border-radius:4px;font-family:Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-weight:600;direction:ltr;unicode-bidi:embed;background-color:rgb(248,248,248);line-height:16px">/videos/[ID]/[STRING]/most_recent/[last_year|all_time|videos|this_year|last_week|last_month|today]</code></span></div>
</blockquote></div></div>