.htaccess redirect for a URL on a specific referrer page

I could do with some help on what code I’d use in .htaccess to acheive the following redirect:

The condition should look at the following:

  • if the page the link’s on matches then continue
  • if the URL on the previously mentioned page matches then do the URL rewrite

URL rewrite:
from example.com/page1
to example.com/page1?utm_source=abc&utm_campaign=101
when the referering URL / page is abc.com/forum.php?thread=1234

I hope my explanation of what I want makes sense.

You can sure do that using mod_rewrite a RewriteCond with %{HTTP_REFERER}
(referer with just 1 r is ~not~ a typo on my part, that’s really what you need to use)

As a good intro to mod_rewrite I’d recommend you read Apache’s mod_rewrite