The only required part is everything up to the thread ID (https://coderanch.com/t/572113/), everything behind that is not significant and can be chosen at will (or left out altogether). So there's no "rewriting" going on here.
But there's nothing to it. If "https://coderanch.com/t/572113/" is the integral URL, all you need to do is to set up whatever code handles "/t" URLs to extract the ID from the URL and ignore everything that comes after it.
Ulf Dittmer you are right but how can i cancat title or subject of topic before fetch. As per your suggestion "https://coderanch.com/t/572113/" based on 572113 id i will fetch topic from db. but i need url like this https://coderanch.com/t/572347/Servlets/java/Servlet-Asynchronous-Operations ,which is not possible before fetching..
Sorry i am stretching this topic but solution is really helpful for me
What do you mean by "fetching", and what does a DB have to do with non-functional parts of an URL? Wherever you want to display the URL, just append whatever you want appended, and then ignore it when interpreting it on the server. That has no bearing on how the page that's behind the URL is stored or retrieved.