Secure your wordpress website from hackers

Prem Tiwari - - WordPress, WordPress Snippets

You may have been working on a website, or reading an article about web development, and heard about the .htaccess file, but wondered what it was, or what, if anything, you can do with it.

This tutorial will tell you the basics about .htaccess, and show you a few ways to secure your wordpress website from hackers


1. Blacklist undesired users and bots ip address

2.- Redirect visitors to a maintenance page

3.- Redirect www to non www or vice versa

4.- Force Caching with htaccess

The following htaccess code won’t help the initial page load, but it will significantly help subsequent page loads by sending 304 statuses when requested elements haven’t been modified.

5.- Allow only your IP address on the wp-admin directory

Allow only your IP address to access administrator area of your website. This will help you from hackers to hack your website. Copy paste code in your .htaccess file and upload it to root directory of website.

6.- The easiest way to ban a WordPress spammer

7.- Deny access to your wp-config.php file

8.- Enable gzip to speed-up your wordpress website

Is your website taking more time to load, if yes, copy paste below code in your .htaccess file. Below code will enable gzip compression for your website, which will reduce web page loading time.

9- Redirect Old domain to New domain

If you want to redirect your old domain to new domain, then create .htaccess file on root of your website and copy paste below code.

10- GZip compression

Please don’t forget to share and subscribe to latest updates of the blog. Comments and feedbacks are always welcome! Thanks!

Prem Tiwari

Prem Tiwari is the founder of and also a professional developer and a blogger by hobby.

Tags: , , , ,

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.