simczak, Welcome to WebmasterWorld!
The usual approach is to change the links on your pages to output the static URLs, and then use mod_rewrite to change those URLs, when requested from your server, back into the form needed to invoke your script(s).
See [webmasterworld.com...] for more information.
Jim