Our valued sponsor

Cool WordPress features an beginners manual.

Moh1

Corporate Services
Jan 28, 2009
183
15
18
Visit site
Hi fellows,


I wanted to share this link with you, if you are struggling in the setup of your wordspress or just curios about which other features WordPress might have, the check out this link:


Stupid WordPress Tricks ? Perishable Press


This guy has been around for several years and seems to know WordPress very well.

As explained in my article, denying access to no-referrer requests, you can greatly reduce the number of spam comments by eliminating all direct requests for your blog’s comments-post.php file. This will block automated spam scripts from bypassing your comments form by hitting the comment processing script directly. Here are two ways to block no-referrer comment requests, one uses HTAccess and the other uses PHP. Here is the HTAccess method:
Code:
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .wp-comments-post.php
RewriteCond %{HTTP_REFERER} !domain.tld [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) http://%{REMOTE_ADDR}/$ [R=301,L][/PHP]

Place that code in your site’s root HTAccess file and edit the “domain.tld” to match your own domain. Once in place, this code will redirect any request for your blog’s comments-post.php file that didn’t originate from your site back to the URL from whence it came.
This may also be accomplished via PHP. Place the following function in your theme’s functions.php file:
PHP:
function check_referrer() {
	if (!isset($_SERVER['HTTP_REFERER']) || $_SERVER['HTTP_REFERER'] == '') {
		wp_die(__('Please do not access this file directly.'));
	}
}
add_action('check_comment_flood', 'check_referrer');

The above is what I just used on my blog... hope you enjoy.
 
Thank you for sharing this information, I tried it on one of my wordpress blogs and indeed it works good, also I found other great tricks to modify my wordpress blog...
 
Stupid WordPress Tricks ? Perishable Press
This could really be helpful and also help the blog to index better in google... really great link you found there Moh1 - btw. is that your blog or really just one you found ?
 

Latest Threads