What is the most recommended way to get rid of a trapped nerve in back?

Depends. To correct a trapped or compressed nerve, that hasn't repsonded to conservative non-operative treatments, the most recommended procedure is a laminectomy. This is a surgical technique in which portions of the lamina (bone), ligamentum flavum (ligament), facet joint, and/or disc are removed to decompress the trapped nerve. Occasionally, a fusion may be necessary to acheive the expected result.
Non operatively as . 90% get better with time but treatment can include: medication, exercise, activity modification, physical therapy & even pain management via injections like epidural steroid injections. For those that do not respond to a satisfactory degree & imaging studies correlate with symptoms & physical exam findings, surgery can be done with the type of surgery dependent on the causes of the nerve issue.