Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have the following rules set in my .htaccess file to block spam. It works by not allowing anyone to login, register, or make a comment unless the conditions are met. It works, but I would like to add Contact Form 7 (version 3.2) in there somehow.

RewriteCond %{HTTP_COOKIE} !^PHPSESSID=\w+ [OR]
RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?example\.com/ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule ^wp-(comments-post|login|register)\.php http://example\.com [R=301,L,NS]

I've tried using wp-contact-form-7.php and submit.php. I've also tried using the uri /contact-us/ where the contact form is located and none work.

share|improve this question

closed as off-topic by birgire, Pieter Goosen, Mark Kaplun, Johannes Pille, G. M. Sep 15 at 23:08

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Your question should be specific to WordPress. Generic PHP/JS/HTML/CSS questions might be better asked at Stack Overflow or another appropriate site of the Stack Exchange network. Third party plugins and themes are off topic." – birgire, Pieter Goosen, Mark Kaplun, Johannes Pille, G. M.
If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.