• Resolved Alpesh

    (@alpesh_p2010)


    I have been using Contact Form 7 from the past few years and never had any issues with it.

    Today, I suddenly decided to test the contact form on my site and after entering the details I have clicked on Submit. It doesn’t do anything, after clicking on Submit ajax loading shows continuously without any error message.

    So, I checked the console and found

    GET https://domain.com/wp-json/contact-form-7/v1/contact-forms/3/feedback/ 404 ()

    I have checked the REST API Settings and everything is good with it, still, the form is unable to submit.

    Please look into this issue and resolve it ASAP.

    • This topic was modified 6 years, 6 months ago by Alpesh.
    • This topic was modified 6 years, 6 months ago by Alpesh.
Viewing 15 replies - 1 through 15 (of 20 total)
  • Thread Starter Alpesh

    (@alpesh_p2010)

    Found a fix to this problem.

    I checked my .htaccess file and found that I use trailing slash redirect. So, decided to remove the redirect and test out the form. This fixed the issue.

    Modified the trailing slash redirect to exclude URI containing /wp-json and this did the trick. Below is my trailing slash redirect .htaccess code.

    # Add trailing slash to the end of the link
    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !(.*)/$
    RewriteCond %{REQUEST_URI} !^/wp-json
    RewriteCond %{REQUEST_FILENAME} !\.(gif|jpg|png|jpeg|css|js|xml)$ [NC]
    RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1/ [L,R=301]
    # End Adding trailing slash to the end of the link
    • This reply was modified 6 years, 6 months ago by Alpesh.

    Thanks this fixed my issue!!

    Do you know why this suddenly happened? Did a WP update cause this error?

    I’m dealing with the same issue all of a sudden. Do I just add that code snippet to my htaccess file?

    Hi @cocktail5555

    I just added this line to my htaccess:

    RewriteCond %{REQUEST_URI} !^/wp-json

    Thank you @alpesh_p2010

    Another reasons for
    GET /wp-json/contact-form-7/v1/contact-forms/3/fill/ 404
    and
    POST /wp-json/contact-form-7/v1/contact-forms/3/feedback/ 404
    can be >

    1. If you’ve disabled REST API (manually or e.g. with Clearfy)
    2. If you use plugin load filter (https://de.www.ads-software.com/plugins/plugin-load-filter/) and filter CF7 for pages.

    as I found out.

    Cheers,
    Ben

    • This reply was modified 6 years, 2 months ago by ZenBen.
    • This reply was modified 6 years, 2 months ago by ZenBen.

    If you use plugin load filter (https://de.www.ads-software.com/plugins/plugin-load-filter/) and filter CF7 for pages.

    @zenben you are right! i use “Plugin Organizer” to selectivelly load contact form only for contact page and i get some error:

    GET ...jquery.js?ver=1.12.4:4 GET https://www.orsilimolino.it/wp-json/contact-form-7/v1/contact-forms/4/refill

    in my case how can i fix it?

    @nonchiedercilaparola

    Add a plugin filter with the permalink set to https://www.orsilimolino.it/wp-json/contact-form-7/ and select the also affect children checkbox. Then enable Contact Form 7 on the filter.

    For me only rollback to v4.7 worked… htaccess edited like advised above, all plugins disabled/enabled, rest api checked – always 404, no result… still very curious what is the reason…

    I have the same error

    wp-json/contact-form-7/v1/contact-forms/61789/refill 404

    I have tried to add

    RewriteCond %{REQUEST_URI} !^/wp-json

    to htaccess but this doesn’t work.

    Now what?

    If you are using wpbakery. go to frontend edit. (when i did, i had to guess where i needed to edit as it wasn’t showing up in the frontend) find the the link that isn’t working. click on edit and then link options. locate the page that it is supposed to find and save. that worked for me.

    FINALLY FIXED!!
    Since I’m using nginx all the solutions doesn’t worked for me.

    I finally fixed the error adding the following lines to the nginx.conf (or file wich contains your server config)

    
    location ~ ^/wp-json/ {
        rewrite ^/wp-json/(.*?)$ /?rest_route=/$1 last;
    }

    I hope it will be useful for someone

    If are you using the plugin “WP Hide & Security Enhancer “, edit your .htaccess (apache) commenting the line with:

    RewriteRule ^wp-json(.+) /index.php?wph-throw-404 [L]

    And add the line:

    RewriteCond %{REQUEST_URI} !^/wp-json

    Thanks @jrubinart, your solution is the only thing that worked for me too.

    Any one know how to fix this ?

    Got this but with a 403 error … Idk how im blocking it

    POST /wp-json/contact-form-7/v1/contact-forms/257/feedback 403 jquery.js?ver=1.12.4-wp:4

    For me the error came from the address registered by contact-form in the action tag of the form, the theme works with preloading pages, so he used the preloading address according to the conditions of access to the page.

    Here is the filter used to counter this error:

    function change_wpcf7_url($url){
    	if (strpos($url, 'semplice') !== false) {
        	$remove_unit_tag = explode('#',$url);
       		$new_url = '/contact'.'#'.$remove_unit_tag[1];
       		return $new_url;
       	}
        return $url;
    }
    
    add_filter('wpcf7_form_action_url', 'change_wpcf7_url');
    

    “semplice” is the theme name and “contact” is the page endpoint i need

    I hope it will help you

    • This reply was modified 5 years, 4 months ago by barbeapapier.
Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘Contact Form 7 /wp-json/ 404 Error’ is closed to new replies.