Support » Plugin: Contact Form 7 » IIS 6 404-redirect (pretty permalinks workaround) fix for Contact Form 7

  • I’ve sent a message via the official site’s contact form, but here’s hoping that it gets seen this way if not via the form submission.

    – Situation –
    IIS6 sites using the 404-redirect workaround so they can have functional pretty permalinks end up breaking Contact Form 7 as it is now (the loading animation doesn’t stop… the form isn’t sent… and there aren’t any visible errors). Yeah, due to circumstances outside of my control… updating to IIS7 isn’t an option :’-(

    – Solution –
    Swap out $url = wpcf7_get_request_uri(); in /includes/classes.php with the following:

    global $post;
    $url = '/index.php?page_id='.$post->ID;

    That’s it! Even though it’s a fix for an old problem… Contact Form 7 becomes permalink agnostic in all cases so it works on any server/permalink configuration.

    I hope this simple fix (or some form of it) gets picked up for being implemented in the native plugin. I’ve modded my plugin, and I’d like to avoid loosing this fix by updating to a future release.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Thanks, but this solution breaks when you put contact forms outside page contents.

    There is the wpcf7_form_action_url filter hook in /includes/classes.php that Contact Form 7 provides for such situations. Better to use it instead.

    Hmm, how about a simple:

    global $post;
    if($post->ID) // Use the post id to make it permalink agnostic (for IIS6 compliance)
    	$url = '/index.php?page_id='.$post->ID;
    else // Utilize the request url
    	$url = wpcf7_get_request_uri();

    Would that work?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘IIS 6 404-redirect (pretty permalinks workaround) fix for Contact Form 7’ is closed to new replies.