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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.