WordPress.org

Ready to get started?Download WordPress

Forums

Cookies for Comments
[resolved] nginx rewrite rule for cookies for comments. Anyone? (2 posts)

  1. Lee H
    Member
    Posted 2 years ago #

    In the description there's these awesome Apache rewrite rules posted that drastically cut down on splog and user signups.

    Since moving servers and going with nginx (which I can confirm makes WP fly), I've been pummeled with bots creating splogs and user sign ups. I just can't keep up with them.

    My Apache rewrite rule skills are weak at best, even after all these years, and this new nginx way of rewriting hasn't even began to sink into my skull.

    Any kind souls able to convert this Apache rule to nginx?

    RewriteCond %{HTTP_COOKIE} !^.*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.*$
    RewriteRule ^wp-signup.php - [F,L]

    http://wordpress.org/extend/plugins/cookies-for-comments/

  2. Lee H
    Member
    Posted 2 years ago #

    Well that wasn't so hard.
    I ended up making a location for wp-signup.php and wp-register.php.
    If the comments for cookies cookie isn't set, a 403 Forbidden is returned.
    Sweet :)

    location ~ \wp-(signup|register).php$ {
    		if ($http_cookie !~ "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") {
    			return 403;
    			break;
    		}
    		# Adjust for your setup
    		include fastcgi_params;
    		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    		fastcgi_pass php;
    	}

    If anyone knows a better way... I'm all ears!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic