• Skip to primary navigation
  • Skip to main content

WebGuide4U

Photoshop | WordPress | Webhosting | Web Designing | Discount Coupon

  • Homepage
  • About Us
    • Author
  • Advertise
  • Free WordPress Installation
  • Contact Us
  • Show Search
Hide Search

[How-To Guide] Avoid Spam Comment In WordPress Using .htaccess

Many time you see your comment spam page and find that few particular IP’s constantly sending spam comments. Now you want to get rid of these spam comments, the easiest way is to block these IP address by using .htaccess. Already I have shared how to guide on creating .htaccess file and how to guide on editing .htaccess file. Now in this post I’m sharing how to guide on avoiding spam comments in WordPress blog using .htaccess file.

Step1: Log-in into cPanel by typing URL (mentioned below). Click on “File Manager” (as shown below):

http://www.domainname.com/cpanel (replace domainname with your own domain name)

avoid-spam-comments-.htaccess+wordpress+how-to-avoid-spam-comments-using-.htaccess

Step2: When you click on “File Manager”, it open a new window, i.e., your root directory (as shown below).

avoid-spam-comments-.htaccess

Step3: In root directory select “.htaccess” file. Now click on “Edit” option in navigation menu as shown below:

avoid-spam-comments-.htaccess+.htaccess+avoid-.htaccess-file

Step4: As soon as you click on “Edit” button in navigation menu, it open a new window (as shown below)

avoid-spam-comments-.htaccess+wordpress+how-to-avoid-spam-comments

Step5: Now copy this code and paste this code in .htaccess file (you have to paste this code in step 4):

<Limit GET POST>
order allow,deny
deny from xx.xxx.xxx.xxx
allow from all
</Limit>

You can get the IP address of the spammer in your comment page, under WordPress Dashboard.

Step6: After pasting this code (code you have copied in step5) in .htaccess file, click on “Save” button as shown below:

avoid-spam-comments-htaccess+wordpress+.htaccess

Step7: Congratulations, you have successfully avoid spam comments in WordPress using .htaccess.

Remember

Replace xx.xxx.xxx.xxx with desired IP.

If you have any query do let me know in comment section and don’t forget to like on Facebook so that you don’t miss any of the tutorials on .htaccess

How-To, WordPress

Reader Interactions

Comments

  1. Anish K.S says

    January 12, 2011 at 07:20

    its a great tip Vivek, thanks will check this.

  2. Vivek Parmar says

    January 12, 2011 at 10:11

    Yaa Anish, its good thing to avoid spam comments if they are increasing in number

  3. Bligbook says

    January 12, 2011 at 21:31

    i would better use an akismet plugin, because it does my total job…

  4. Vivek Parmar says

    January 12, 2011 at 23:31

    Akismet is good but its for those who are receiving too much spam from particular IP’s

Leave a Reply

Your email address will not be published. Required fields are marked *

Hit the ground running with a minimalist look. Learn More

WebGuide4U

All rights Reserved. Articles cannot be reproduced without permission from the author© 2025