hi you, i had the same problem wordpress running on IIS 6 in combination of the 404-handler.php.
i’ve edited the classes.php
1st.
in the function form_html() start a global $post
2nd. i’ve added tose 2 lines, just before the form tag starts.
title = get_the_title();
$url = str_replace($title.”/”, “?page_id=”.$post->ID.””, $url);
<form action=”/contact/#wpcf7-f1-p459-o1
or
<form action=”/contact123/#wpcf7-f1-p459-o1
will be converted to
<form action=”/?page_id=123#wpcf7-f1-p459-o1
maybe there’s an other method to do so but i’m very new at wordpress and this seems to do the trick.