Just use everything after the DNS name:
<a href="/mod/forum/discuss.php?d=1131">link</a>
You just have to be sure that
http://oldsite.com/ --> http://newsite.com/
or
http://oldsite.com/moodle --> http://newsite.com/moodle
but not:
http://oldsite.com/moodle --> http://newsite.com/mycourses
General help
Relative Moodle Links
This discussion has been locked so you can no longer reply to it.