Query parameters in permalinks not being supported while redirecting

In our old forums we are having URLs for our posts like.
In the above link #123 was the post id.
When we are creating a permalink for the post using the above url, the redirection is not happening.
Is there any way to overcome this issue.