wow, your are usnig something that im using in my forum. your mod is diffrent. let DCZ see this topic. he can solve it for you.
by the way with using zero duplication mod you can redirect all of that links with .php prefix to proper .html one. for example i have a mod in my forum that can find similar topics and show them under each topic. see this page
http://forum.persia-cms.com/phpbb-3-phpbb3-vt844.html
at the bottom of the page there is some links to related topics. move your mouse cursor on topic titles. all of them have .php prefix. click on one of them and see the URL in address bar

.
zero dupelicate can redirect link to proper html equivalent URL with 301 redirect. its completely safe.