WordPress .htaccess tips

| October 8, 2010 | Leave a Comment

Controlling how URLs behave and who access your site rely on the .htaccess file, and while some of the things it can do have a comfortable interface inside WordPress, there’s so much more to explore. WP Shout goes from A to Z of those possibilities.

For example: if you need to stop spambots, try denying no-referrer requests with this code:

RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
RewriteCond %{HTTP_REFERER} !.*yourblog.com.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]

Need to study the somewhat cryptic .htaccess language further? Head over to Apache’s official documentation.

Related Posts

Tags: , , , , , , , , ,

Leave a Reply