• Skip to main content

Victor Font Consulting Group, LLC

Strategic IT Solutions for Complex Organizations

  • Home
  • Care Plans
    • Care Articles
    • Optional Subscriptions
  • Consultations
  • Products
    • Code Snippets
    • Public GitHub Repositories
    • Gist Snippets
    • Pastebin Snippets (Free)
    • Free Plugins
  • FAQs
  • Support
    • Graphic Design
  • Contact
    • Speakers
    • Portfolio
  • Resources
    • Free WordPress Video Training
    • Tutorials
    • Articles
    • Cybersecurity
    • EU Referral Network

Avert Attacks on Your Site with This Simple Technique

posted on July 7, 2014

Here's a very simple way to avert attacks on your WordPress site. In most cases, hackers will try to attack a WordPress site by directly accessing wp-login.php or admin-ajax.php.The following code, added to your site's .htaccess file, redirects hackers to a fake url. Make sure you change the IP address to your IP address in the code, otherwise you'll be redirected as well.

Grant a single IP Address access:

## .htaccess rule to prevent an attack that from happening on this site.
# Please edit the 123.45.67.89 numbers to match your own IP address.
# For example, the IP 64.207.234.198 needs to
# be changed to look like !64.207.234.198 in the rule.
##

    RewriteEngine On
    RewriteCond %{REMOTE_ADDR} !123.45.67.89 [NC]
    RewriteRule .*  [R=301]

To grant multiple IP addresses access, change the following line:

RewriteCond %{REMOTE_ADDR} !123.45.67.89 [NC]

To:

RewriteCond %{REMOTE_ADDR} !(123.45.67.89|123.45.67.89) [NC]

  • 5shares
  • Facebook0
  • Twitter1
  • Pinterest0
  • LinkedIn4
  • Print
  • SMS0

About Victor M. Font Jr.

Victor M. Font Jr. is an award winning author, entrepreneur, and Senior IT Executive. A Founding Board Member of the North Carolina Executive Roundtable, he has served on the Board of Advisors, of the North Carolina Technology Association, the International Institute of Business Analysis, Association of Information Technology Professionals, Toastmasters International, and the North Carolina Commission for Mental Health, Developmental Disabilities, and Substance Abuse Services. He is author of several books including The Ultimate Guide to the SDLC and Winning With WordPress Basics, and Cybersecurity.

 
We only use analytical cookies on our website that allow us to recognize and count the number of visitors, but they do not identify you individually. They help us to improve the way our website works. By clicking Accept you, agree to cookies being used in accordance with our Cookie Policy.