The motion of active polymers in a porous medium is shown to depend critically on flexibilty, activity and degree of polymerization. For given Peclet number, we observe a transition from localisation to diffusion as the stiffness of the chains is increased. Whereas stiff chains move almost unhindered through the porous medium, flexible ones spiral and get stuck. Their motion can be accounted for by the model of a continuous time random walk with a renewal process corresponding to unspiraling. The waiting time distribution is shown to develop heavy tails for decreasing stiffness, resulting in subdiffusive and ultimately caged behaviour.