I looked how this forum did it:
In the login page it submits a hidden value:
<input type="hidden" name="url" value="/board/newreply.php?do=newreply&noquote=1&p=10761577" />
Then in the next page the link is to the right page: <a href="/board/newreply.php?do=newreply&noquote=1&p=10761577">Click here if your browser does not automatically redirect you.</a>
With a little research I am sure that you would have found it out by only looking at the source.