我正尝试通过不发送消息来解决CF7问题时遇到此类错误:
{"code":"rest_no_route","message":"No route was found matching the URL and request method","data":{"status":404}}
我在WP支持论坛上发现,这是因为某些.htaccess规则用斜杠改写了此类URL:
https://www.example.com/wp-json/contact-form-7/v1/contact-forms/1253/feedback
我有一个非常复杂的.htaccess文件,无法自行修复。
但是可以添加一些规则来解决该问题-删除所有以开头的URL的斜杠 / wp-json /?
感谢您的帮助!
答案 0 :(得分:0)
# Force trailing slash in WP without damaging the admin interface or the JSON API
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/wp-json
RewriteCond %{REQUEST_URI} !^/wp-admin
RewriteCond %{REQUEST_URI} !^/([_0-9a-zA-Z-]+)/wp-json
RewriteCond %{REQUEST_URI} !^/([_0-9a-zA-Z-]+)/wp-admin
RewriteRule ^([^.]+)([^./])$ %{REQUEST_URI}/ [L,R=301,NE]
</IfModule>
在这里Add trailing slashes in WordPress Multisite without damaging the admin interface or the JSON API