How to Secure a Website – The Comprehensive Guide (2020)

How to Secure a Website

The topic for today is Website Security, and it’s interesting as well as challenging to discuss as it changes every minute or even seconds.

The popular queries around the internet;

  • How to secure a website?
  • How to implement web application security?
  • Is this website safe?

This comprehensive guide provides a clear framework for site owners to secure their website from hackers and security vulnerabilities.

Table of Content

Before we dive in with in-depth strategies, let’s know about the general aspects surrounding website security.

What is Website Security?

Website security is a managed process or action taken to protect a website from different attacks or exploitation. It is an ongoing strategy and a crucial part of website management.

Why is Website Security Important?

Let’s put this discussion with an example first.

The Question: What would happen if you leave your home unattended or unlocked when you are away?

The Answer: There is a 50/50 chance that either your home gets robbed and smashed, or nothing happens because it’s your lucky day.

Door Lock Security

In the real world, we hope, you with your family and friends don’t have to deal with this situation and wish every day is lucky for you.

But the same thing can’t be assumed for the security of your website.

There are undeniably numerous ways people or bots can attack your site or web application.

So, you must take web security as a serious threat. Why?

  • To protect it from hack attempts and malware.
  • To prevent a data breach for your clients or business.
  • To improve your search engine rankings.
  • To stop attackers from abusing web server resources.
  • To block phishing campaign emails from your website and lots of other reasons.

You have put a considerable amount of your time and effort into your website. What would happen to your online presence if an attacker gains access to your website?

So, you need to implement active security measures to defend these attacks and improve website security.

Companies spend millions on security, and it’s money wasted. None of these measures addresses the weakest link in the security chain - Kevin Mitnick ( The World’s Most Famous Hacker)

Why and How do Websites Get Hacked?

According to Internet Live Stats and Google, “There are over 1.73 Billion websites on the internet, and over 113,000 websites get hacked daily.

Statistics of Live Websites

Depending on who you are, the results can vary. Some of the main reasons;

  • Commercial Gain – Your competitors or enemies can benefit from your downfall. What would happen if Google Chrome gets hacked today? Bing gets the audience. Just saying!
  • System Resources – The business of renting system resources is a big trade and a huge motivator for many cyber groups.
  • For Fun – There is a good chance that sometimes these attackers are a computer-savvy person with nothing else to do except hacking websites.
  • Online Protest – Instead of yelling and burning wheels on the streets, hacktivists will damage websites to gain attention and spread their word.
  • Money – Does this need an explanation? I don’t think so.

You can be sure that website security threats are here to stay, and hacking will get advanced every minute or second, day by day.

But to operate and be successful with the hacking attempts, one needs to break the barrier between the web servers and applications.

But how exactly websites get hacked?

There are millions of ways that a website can get hacked. It’s a vast issue in reality.

Cyber-threat is mainly a reflection of our weaknesses. An accurate vision of digital and behavioral gaps is crucial for a consistent cyber-resilience - Stephane Nappo

The most common and popular ways a website can get hacked are listed below;

  • Data Leakage – The biggest issue is Data Leakage in today’s online world. A famous example would be the Data Breach of Linkedin, where 117 Million accounts were compromised and sold on the black market.
  • Weak Passwords – This is the easiest way to lose your access to your login credentials. A weak password can easily be decrypted with today’s technological advancement.
  • No Regular Updates – In addition to fixing bugs or glitches, the regular updates typically come with security enhancements. People make the mistake of implementing inconsistent updates.
  • Not Limiting User Permissions – Neglecting to limit the user permissions can be a recipe for disaster. Not every employee or client of your business should have access to your server configuration.
  • Using Insecure Protocols – Protocols might include not using encryption technology, visiting untrusted websites, weak web server security, and cracked software.

Even though there are several methods by which websites can get infected, the number one reason would be negligence from people.

And second, would be poor code implementation in general.

There are two typical ways people use precautions for website security;

  1. Precautions used after the incident.
  2. Precautions used before the incident.

Let’s compare these topics to human health for easy understanding.

Would you prefer to take care of your teeth and avoid a dentist visit, or would you choose not to give a damn about your teeth and wait for a dentist’s visit?

As you can notice, it ultimately comes to your personal preferences. Still, even though it’s about your preferences, it’s a wise decision to take care of your teeth and avoid a visit to a dentist.

On the contrary, it would be profitable for your health.

Ultimately, you can save an ample amount of time and money.

So, you can see for yourself why you need to be one step ahead of your attackers.

The same philosophy integrates with website security. It’s nearly impossible for any website in today’s context to be 100% secure, but you can make this tough for attackers.

Recover Hacked Website

You should know the fact that it’s expensive to recover a hacked website than having a web security plan managed beforehand.

Consider your website as a "Glass" in an online world. You need to polish it every day and try to make it shiny compared to your competition so that your audiences can see through your website.

You need to be aware of the fact that there are lots of ways to join a broken glass, but once broken, it will leave a mark on its structure.

So, it’s wise to protect your website beforehand, then wait for the disaster to arrive your way.

Now that you have a rough idea, how web security works, let’s dive in with in-depth strategies to mitigate risk and implement security protocols for your site security.

Website Vulnerabilities and Mitigation Plans

A website can get hacked or attacked due to many factors. Still, some of the leading and widely used cyberattacks are discussed below.

1) SQL Injections

These types of injection attacks are very effective. The attacker attempts to access or alter the user input or SQL query of a web system by manipulating the user-supplied data to a website database.

This attack is a high-risk threat because if successful, the attacker can alter the user-submitted data to his desired outcome instead of the information expected from the website database.

SQL Injection

What are the impacts?

  • Sensitive data from the website database, including personal information and hash files, can be read.
  • Database queries can be altered. They can be edited, deleted, or even updated.
  • In some circumstances, an attacker can obtain persistent backdoor access into an organization’s systems.

What are the mitigation plan to prevent SQL Injection?

  • Use prepared or parameterized queries.
  • Validate user input data.
  • Limit user privileges.
  • Use stored procedures.
  • Hide info about the error message.
  • Encrypt database credentials and store them in a separate path.
  • Disable shell access and other related functionalities if not in use.

To avoid a SQL Injection Attack, you always need to be cautious and be prepared for the worst. Don’t forget to validate and sanitize all the user interactions.

2) Cross-Site Scripting

Cross-Site Scripting is also known as XSS Attack in a technical term.

These security vulnerabilities usually inject a malicious script that is executed on the client-side, such as a browser or web application’s output.

These flaws can occur when the application or script takes untrusted data and sends it through a web browser or web application without any proper validation.

These flaws could potentially lead to a site takeover.

Cross Site Scripting

What are the impacts?

  • XSS Attack can result in the user’s session cookie being disclosed. It allows attackers to take over the user’s account and manipulate their sessions.
  • Disclosure of end user’s files.
  • Install malware and spyware.
  • Leakage of sensitive data.
  • Creating falsified information and targeting client-side users.

What are the mitigation plan to prevent Cross-Site Scripting?

While cross-site scripting attacks can be hard to predict and detect, the best practice would be to validate and sanitize the vulnerabilities.

It will help if you utilize web application firewalls to reduce and prevent XSS attacks.

3) Brute Force Attacks

These attacks are an attempt to crack down on login credentials, from a published or hidden web page, again and again, until the attackers get access to their source.

Guessing login credentials for a particular site or source can take a long time.

Hence, hackers and organizations have developed tools to help with brute-force attacks to do their job faster and easier.

You should know that the outcome would be catastrophic if the attackers get access to your credentials.

Brute Force Attacks

What are the mitigation plan to prevent Brute Force Attacks?

  • Use a complex password.
  • Protect your personal information.
  • Limit the login attempts.
  • Modify and secure .htaccess file with appropriate file permissions.
  • Use honeypot or captcha.
  • Utilize two-factor authentication.
  • Use content delivery networks (CDNs).
  • Deploy web application firewalls (WAF).

Preventing and neutralizing a brute force attack in progress is the best counter-attack strategy than waiting for attackers to have access to your network or source.

4) Malware Infections

Malware is a type of software or source code that attempts to steal user credentials or manipulates the user’s computer to do things that users don’t intend to do.

The malware infections are used in a large number to attack and infect websites and are a severe security threat.

Malware infections often lead to severe consequences, causing the victim’s computer to become slow or unresponsive. This leads to a website takeover.

Website Malware Infections

What are the impacts?

  • You can see lots of unwanted ads while unusual changes to your website appearance.
  • Your audiences can be redirected to other sites that could be malicious.
  • They can drop backdoor access to attack your website.
  • Attackers can place spam content and use SEO spam techniques to divert your site traffic to other sites. 
  • Your reputation, business sales, web traffic, and your brand identity will likely take a hit if your website is infected with malware. 

What are the mitigation plan to prevent Malware Infections?

  • Install updates and patches promptly.
  • Maintain regular backup of your website.
  • Use Anti-Malware software or related software.
  • A website’s risk of infections increases with features and functionality it has. So, only use features or functionality you need.
  • If there is no need, disable file uploads for better online security.
  • Try to use an automated patching system and threat intelligence service.

Cybercriminals don’t rest, and they will do their best to defame your website and your reputation all over.

You can protect your website against those cyberattacks with a web security service provider that is one step ahead of them.

5) Security Settings Misconfiguration

Security Settings are critical and must be defined and deployed for the web servers, applications, databases, cookies, and framework platforms.

In simple words, security misconfiguration merely is incorrectly constructing the file permissions or rules for your files and folders.

If these settings are not correctly configured, then it’s a free meal ticket for an attacker to get unauthorized access to sensitive data or functionality of your website.

Website Security Settings

What are the impacts?

I know automatic cars are already a reality in today’s world, but for our discussion, let’s talk about a manually handled car.

What would happen if you put your car in neutral mode and let it roll down a steep hill without a driver inside it?

The consequences will be disastrous!

Likewise, if a web application lacks proper security protocols, an attacker can access default accounts, unused web pages, unprotected directories, or exploit unpatched flaws.

If that happens, they can gain unauthorized access to your systems.

What are the mitigation plan to prevent Security Settings Configuration?

  • Disable default accounts and passwords.
  • Keep your software updated with regular security patches.
  • Hire a professional to do the security hardening process for your website to be on the safe side.
  • Don’t present stack tracers to your website users or audiences.
  • Run automated tools and perform regular internal audits to identify security loopholes in the server configuration.

Website security tools are much more complex and advanced today. So, you need to be updated with the latest security trend in the markets.

6) Lack of Encryption Technology

Information exchanged between the user, and the server must be served through a secure socket layer using encryption technology.

Web applications frequently transmit sensitive information or credentials like user authentication details, cookies, credit card information, and session tokens over a network layer.

Don’t make a mistake of using weak algorithms, expired or invalid certificates, and non-functional hard drive encryption technology for data transmission between your web server and your audience.

What would be the impact if your audience gets exposed to cyberattacks?

Your reputation would be destroyed, and you can be in trouble with legal departments to make it worse.

Encryption Technology

What are the mitigation plan to prevent Lack of Encryption Technology?

You should use SSL Certificate and Encryption Technology services for your website.

It is essential even if you do not handle sensitive information like credit cards.

It provides privacy, data integrity, and critical security for both your website and users’ personal information.

7) DDoS Attacks

DDoS, also known as Distributed Denial of Service, is an attack that makes a site unavailable with automated or manual fake requests and web traffic.

DDoS attacks are non-intrusive internet attacks on web servers that can cost websites thousands of dollars.

Typically, nothing is hacked while a website in under DDoS Attacks.

The primary purpose and impact of these types of attacks are to flood your server with web traffic to overcrowd your web server and make it inaccessible to your audience.

What would be the outcome if Facebook, Youtube, or Google goes offline for about 10 minutes?

Just imagine the burst!

Unfortunately, if you fall victim to a DDoS Attacks, then you are likely to be attacked again.

According to Imperva Studies, they found out that two-thirds of DDoS attacks were hit repeatedly.

DDoS Attack

What are the mitigation plan to prevent DDoS Attacks?

In reality, the only way to get rid of the DDoS attack is to engage in a counter-attack strategy.

If a web server can throw more resources behind a website than the attacks, there is a good chance that the site stays up.

Otherwise, it will go down and be unavailable.

Let’s say you have a web server that can host around 25,000 simultaneous requests on any given day.

Then suddenly, some programmed bots attack your website with over 30,000 fake requests per hour. If that’s the case, would you be able to stop the attacks?

No, it’s impossible to stop such kinds of DDoS attacks with your available web resources.

In those cases, it’s wise to consult a web security expert for help or use a Web Application Firewall to secure your website from DDoS Attacks.

Website Protection Best Practices

When you are building an online presence for your business, you must be well-prepared in advance and have a well-managed strategy beforehand.

Due to high competition in today’s business markets, you can’t afford to make a mistake of “I will see when the time comes,” philosophy.

Everyone can predict and fantasize about the future, but until now, no one exactly knows about the future.

No one can give you a guarantee to secure your website without any obstacle.

However, there are methods that companies or individuals can implement to help reduce the chance of running into web security dilemmas.

1) Create a Blueprint

Site owners and web developers need to make pre-planned arrangements from the very beginning for better online security for their websites.

All too often, taking a disorganized approach to the situation will end up gaining next to nothing.

Create Business Blueprint

Sit down with your IT security team or consult a web security expert about developing a detailed and actionable web application security plan.

2) Use Secure Hosting Provider

Out of the many factors, web server-level security plays an essential role in your website security?

Hacking websites will be an easy task for attackers if you have a weak web hosting provider.

Even though you make every detailed effort to secure your website, you can be in trouble, if you are weak in terms of server-level security.

So, you must choose a host that you can trust with your website.

It takes multiple website firewall, server configuration, and security measures to ensure that the infrastructure securing your website is stable and top-notch.

There are lots of hosting providers in the market, so I don’t want to touch this topic here.

If you want me to name a suitable hosting provider, then look no further than Vigorous IT Solution.

Secured Hosting Provider for your Business

Security is their top-most priority for their client’s websites.

They built their security architecture from the beginning of their framework, which is a much more secure method than offered by other competitors in the markets.

3) Update your Systems

You must have heard this for quite a long time form quite a big audience because it is vital and necessary.

Updates might contain security improvements or patches for a vulnerability.

Most cyberattacks are automated nowadays. Bot continuously scans your website and are on standby to attack as soon as they find a loophole in your web directory.

Update Your Systems

Bots attack is one of the main reasons to use website firewall services, as these services virtually patch the security loophole as soon as updates are released.

You need to run regular hardware and operating system updates to secure your website from hackers.

4) Use Strong Passwords

There are breached passwords available all over the online platform.

So, there is always a high-risk of someone cracking your passwords and compromising your login credentials.

Use Strong Passwords

Always be on the alert to secure your website from hackers.

  • Do not reuse your password, which has been already used for your other accounts.
  • Use a long password with a variety of different characters.
  • Try to use random letter combinations for your passwords rather than a dictionary word.

Hackers will use automated bots and software to combine available passwords to generate even more extensive lists of potential passwords.

So, you need to be careful with these types of website security threats.

5) Limit Fewest Privileges Possible

Consider using the minimal set of permissions privilege for your files and folders to perform an action or query. Only grant access to your trusted ones to prevent security risks.

You must carefully define file inclusion rules to limit mistakes. Only highly level authorized people or organizations should be granted access to the system changes.

Try to create single accounts with secure password combinations for everyone on your team with specific access.

So, even accounts get compromised, you can have administrative access to prevent injection attacks.

6) Website Backups

Your website could be hacked, break after an update, or delete critical files by mistake. Disaster can strike anytime. So, you need to protect your website in every step.

So, to avoid these security disasters, the safe options are to run regular backups.

Whether it’s automatic backups or a manual, as long as you are doing it right, it doesn’t matter.

Backing up all your websites and databases, irrespective of your hosting provider is extremely crucial in one clean stage.

Website Backup Services

If your website gets hacked or attacked, having website backup can be useful. These services store your website copy in a secure environment, free of faults or security vulnerabilities.

Implementing an effective website backup process could save your business’s reputation and data from cyberattacks in the long run.

As your business grows or needs upgrades, you need to migrate your content and website backups can be handy in those situations.

7) Install SSL Certificate

SSL Certificate provides authentication and encryption, reassuring your audiences that their data and transactions are encrypted through a secure socket layer.

Premium SSL Certificates

SSL Encryption Technology helps to ensure that your information or credentials are sent to the right server without getting intercepted.

Importance of SSL Certificate;

  • Encrypts sensitive information.
  • Increases trust with customers.
  • Builds brand power.
  • Required for PCI compliance for those who accept credit card information on their website.
  • Better SEO rankings.

Having an SSL Certificate assures that you care about data security, which provides audiences with extra confidence.

8) Use a Website Security Service

I understand that people sometimes don’t have enough time to take care of every aspect of the website due to their tight schedules.

It’s good to make yourself occupied rather than playing PUBG on your mobile phones. Just saying!

If these kinds of situations occur, asking help from the web security service providers is the right decision.

These companies or organizations are well equipped with website security tools and experts to help you know the security risks in and out.

Before you choose the provider, you might first want to get the answer to this question;

Are the malware cleanups manual or automatic?

Many organizations or companies are using automated bots to clean up the infections, which are not bad. Still, you need to know that human beings create every technological advancement.

Website Security Services

There is a good chance that bots won’t clean every infection. So, you need to pick a provider who has professional security analysts working on-site, 24/7.

Additional Questions;

  • Is the service charged per site or page?
  • What kind of protection can they provide?
  • How easy is the setup?
  • Is there ongoing protection after the cleanup?
  • How do they respond after an incident occurs?
  • Do they monitor search engine blacklists?
  • Do they stop SEO spam?
  • What about virtual patching?
  • Is there a limit on cleanup service, or is it unlimited?
  • Do they run regular automatic backups?
  • Is the website firewall included in the service?

Using a web security service is like paying a premium to your insurance company.

You don’t pay because you expect something wrong to happen, but instead you pay; if something happens, you have a backup to cover the costs.

Security Practices for Widely Used CMS (WordPress Security)

CMS, usually known as Content Management Systems, are widely used nowadays.

CMS provides a well-structured and functional framework platform for website owners or organizations to create different types of website developments.

The prominent reason site owners use Content Management Systems is for ease of use and low cost compared to custom website development.

Most CMS exploits rely on the browsers, so you need to take CMS Security as a serious commitment and perform regular security scans to protect your site.

Top 10 CMS currently in the market;

  1. WordPress
  2. Wix
  3. Squarespace
  4. Joomla
  5. Shopify
  6. Drupal
  7. Blogger
  8. Prestashop
  9. Magneto
  10. Weebly

Even though there are lots of CMS available in the market, we will discuss the Top Open-Source CMS (WordPress) at the moment.

Regularly Audit WordPress Themes and Plugins

Don’t worry! The above strategies will help you mitigate risk and protect your website from hackers and security vulnerabilities, whether it’s CMS or custom development.

You should be aware that, “Something is always better than Nothing” in terms of the business environment.

WordPress Security

Well! Where to start?

WordPress is an open-source platform that is a big hitter in the website market with the highest CMS share. As of December 2019, WordPress has a 62% share in the CMS market.

To clear the confusion, we are talking about wordpress.org, the robust and self-hosted platform.

WordPress Security Infographic

WordPress isn’t going anywhere, so you can be sure WordPress will be growing over the coming years. With popularity comes the risk in high numbers.

So currently, WordPress websites are among the highly trafficked sites.

I assume you have gone through the above security vulnerabilities and mitigation plan to get a vision of web security. If you haven’t, you can skim through, before or after this discussion.

Now let’s discuss the security practices you can use to secure your WordPress and stop the attacks.

1) Change the Database Prefix

Before setting up a new WordPress installation, make sure to change the database prefix, which is usually wp_ as a default setting.

You can find these settings in the wp-config.php file. To alter the prefix, change the default setting to your desired name;

$table_prefix = 'wp_';

TO

$table_prefix = 'yourchoice_wp_againyourchoice'

If you already have installed WordPress with the default database prefix, then go through this well-written tutorial on how to change the WordPress database prefix by Zuziko.

Even though you can change database prefix using Plugins, we don’t recommend it.

2) Rename your Login URL

It’s no surprise that lots of attacks happen on the default login page. Some bots are programmed to recognize and exploit the default WordPress login page.

You can change the Login URL manually, which needs some coding skills. Even though it’s possible to manually change the login page, this is not a good idea for a couple of reasons;

  1. Every time you update the WordPress, the login page re-creates a new hash file. That means you need to change the URL again.
  2. Sometimes, it can cause issues with other important site functionality. If it’s a staging site, no worries, but if it’s a live site then, you know the outcome.

Before you test the codes, make sure you have taken a backup because a wrong configuration in wp-login.php can make your website inaccessible.

Manually make changes in the wp-login.php file;

function wp_login_url( $redirect = ”, $force_reauth = false ) {
$login_url = site_url( ‘wp-login.php’, ‘login’ );
if ( ! empty( $redirect ) ) {
$login_url = add_query_arg( ‘redirect_to’, urlencode( $redirect ), $login_url );}

if ( $force_reauth ) {
$login_url = add_query_arg( ‘reauth’, ‘1’, $login_url );}

/**
* Filters the login URL.
* @since 2.8.0
* @since 4.2.0 The `$force_reauth` parameter was added.
* @param string $login_url The login URL. Not HTML-encoded.
* @param string $redirect The path to redirect to on login, if supplied.
* @param bool $force_reauth Whether to force reauthorization, even if a cookie is present.
*/

return apply_filters( ‘login_url’, $login_url, $redirect, $force_reauth );}

If you don’t want to take the coding hassle, you can use the WPS Hide Login plugin, which doesn’t involve manual coding.

WPS Hide Login Plugin

This is the plugin we recommend to change the login URL for your website. This plugin is regularly maintained, and the authors quickly address and release the security patches.

3) Remove Default Username Account

Just because there is a default setting doesn’t mean it’s safe to use the default setting for system configurations.

WordPress now usually requires you to select a custom username at the time of setup for a new installation.

However, some organizations offering the famous 1-Click Installation scheme still set the default username to admin, Ufff! 

Since you can’t create usernames by default, you can use these steps down below;

  1. From your WordPress Dashboard, Select Users > Add New and then start the process.
  2. Now, create a new admin username. Don’t forget to delete the old one, and while you delete it, make sure to attribute your content from your old account to the new one if necessary.
  3. Set the Role to Administrator so that you can delete the old account.
  4. Use WordPress Plugins (Not Recommended).
  5. Update username from phpMyAdmin.

Try to use unique usernames with strong passwords and remove the default admin account in your WordPress installation.

All an attacker needs to do is figure out the password. Then your entire site gets into the evil hands.

4) Use Two-Factor Authentication

You must utilize Two-Factor Authentication for your login credentials to avoid hackers from gaining access to your site.

It acts as an additional security layer. It can be the regular passwords followed by a secret code, secret questions, phone number verifications, or the OTP (One-Time Password) codes.

Two Factor Authentication

The popular plugins that do the job well are listed below;

  1. Wordfence Login Security
  2. Two-Factor 
  3. Google Authenticator by MiniOrange

Why this strategy works Because it’s almost impossible for attackers to have both your password and your two-factor authentication credentials.

5) Utilize the Security Plugins

Sometimes, it’s better to leave the hard work to the professionals or automated tools so that you can relax your mind and loosen up your schedule.

That’s where WordPress, as CMS stands out as it has lots of resources to fulfill every demand of the consumers.

There are lots of plugins and vendors working together to create a secure environment for WordPress.

Security plugins can handle a lot of back-end and front-end security protocols for your website.

Some of the features;

  • Strict-Transport-Security
  • X-Frame-Options
  • Active security monitoring
  • File scanning
  • Malware scanning
  • Blacklist monitoring
  • Public-Key-Pins
  • Content-Security Policy
  • X-Content-Type
  • WordPress Security hardening
  • Post-hack actions
  • X-XSS-Protection
  • Firewalls
  • Compatible settings for Content Delivery Networks (CDNs)
  • Brute force attack protection
  • Much more

The popular and rigid WordPress Security Plugins are listed below for your ease;

  1. Sucuri Security
  2. WordFence Security
  3. iThemes Security
  4. All In One WP Security & Firewall
  5. JetPack

Ultimately, it’s all about selecting the most reliable way to keep the attackers away from your website.

Some security plugins have price tags. You should consider paying if it's necessary. You should know the fact that there is nothing like a free lunch or a product while doing business.

A security breach on your site can cause some unrecoverable severe damage to your business. So, you need to be one step ahead of the attackers.

6) Choose your Hosting Provider Carefully

As I have already touched this topic in the above discussion, I want to remind you again that you need to be very vigilant while choosing your hosting provider.

As we are talking about WordPress Security, I would recommend you to choose a hosting provider that has separate infrastructures and resources for WordPress websites only.

In general, look for Managed WordPress Hosting providers as these kinds of providers custom builts web servers framework with WordPress on the mind.

Again, just a few keywords on Google, and you can find lots of providers on the market.

Managed WordPress Hosting for Businesses

Vigorous IT Solution understands the importance of web servers security, so they have custom-built their WordPress Hosting infrastructures with their client’s needs on the mind.

They have separate web hosting frameworks for different web applications. For example;

  1. Shared Environments  For cPanel (Linux) and Plesk (Windows) Hosting.
  2. Dedicated Resources – For Business Hosting.
  3. Managed Environment – For WordPress Hosting only.

They monitor your sites every minute with tight software-based restrictions in place with 24/7 professional security analysts on-site.

They protect your site from different malicious attacks and continuously add new security patches every now and then.

7) Regularly Audit WordPress Themes and Plugins

As you know, a coin has its two sides. Head and Tail.

Likewise, WordPress has also its Pros and Cons. And those cons usually arise from vulnerable themes and plugins.

You might guess why you should consider auditing themes and plugins.

But believe me, you should never trust anyone 100% in terms of online security.

You should always keep some administrative access only to yourself, which even excludes your team members. Themes and plugins are way out of the league for full trust.

Let me demonstrate this discussion in an example below.

Think WordPress like a White House and Staffs as Themes and Plugins. 

You must be aware that the staff has access to the White House with high-grade weapons.

Even though the staff are well trained and paid for doing their duties, what would happen if staff with full access do something wrong? The outcome would be disastrous.

WordPress Security

You can think of the exact scenario with the WordPress environment.

The themes and plugins are working within the WordPress environment, and they have access to the back-end and front-end of your platform.

So, you need to be very careful to grant access. You should always consider using reputable, well-built, and durable themes and plugins for your WordPress websites.

The best option would be to do market research and check out the reviews and the codes itself before you install any themes and plugins.

8) Use SSL Technology to Encrypt Data

You need to install SSL technology to encrypt information. From a search engine optimization view, it’s a ranking factor.

You can purchase an SSL Certificate from third-parties and install it on your site or purchase it from your hosting provider.

Many web hosting companies provide free or paid SSL Certificates for their clients.

Encryption Technologies

Are there any flaws with free SSLs?

It’s great that organizations are offering free SSL for the good of the Internet. Free encryption technologies are almost the same as paid certificates.

Still, the difference comes down to support, trust, compliance, and many other factors.

You don’t have any warranty or insurance for a free SSL Certificate against fraudulent transactions and other potential issues.

After all, they are providing a free price tag. So, we don’t have any idea, till when they can exist in the market.

You also need to know that the renewal process is 100% automated, which means your site can be at risk of temporarily being unprotected.

So, if you are ok with all these exceptions, then you can go for free certificates. Our only recommended provider would be Let’s Encrypt.

Let's Encrypt

But you should be aware that nothing is free in this world

In short, you can’t be sure that free SSLs don’t have any flaws.

If you don’t believe us and want proof, then you can check the recent blunder of Let’s Encrypt, which affected more than 3 million certificates in an instance.

There are also mentions from big brands why free certificates are a terrible idea.

9) Hardening WordPress Security

Let me inform you that these hardening settings are on an administrative access level, so you need to have full access and must be familiar with some coding.

Don’t worry, if you are not familiar with technical terms, I would recommend you to use security plugins which don’t need coding skills.

  1. All In One WP Security and Firewall
  2. Sucuri Scanner
  3. Wordfence Security
  4. Block Bad Queries
  5. Defender Firewall by WPMU DEV
  6. Shield Security
  7. Cerber Security 

If you are not comfortable with our suggestions, then we recommend using a website firewall service.

As the two leading web server platforms in the current markets are Apache and Nginx servers, we will dive into these two platforms.

As such, please don't blindly copy and paste these rules, as it may cause you to harm if you don't understand fully how NGINX and APACHE interpret the rules!

You need to backup all your current settings and then implement these rules one by one in your staging site rather than the live site.

There is no certainty that the codes below will work for all the sites. It may work on one website and may not work on other websites.

Let’s dive in with the technical hardening process.

Apache Configurations

 

1) Hardening .htaccess

Some of the rules and configurations below depend on Apache versions you are running on the web server.

Rewrite Rule – This is to fix issues with permalinks if WordPress has to write access to your server.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Restrict wp-config.php – These rules restrict your wp-config.php from public use.

# Restrict wp-config Apache (Version 2.2)

<files wp-config.php>
order allow,deny
deny from all
</files>

# Restrict wp-config Apache (Version 2.4)

<files wp-config.php>
Require all denied
Require ip Y.Y.Y.Y
</files>

# Disable File Editing

Use the following line of code in the configuration file, wp-config.php, not in .htaccess file.

define('DISALLOW_FILE_EDIT', true);
define('DISALLOW_FILE_MODS', true);

# Force New Sessions Under SSL Protocol

Use the following line of code in the configuration file wp-config.php, not in .htaccess file.

define('FORCE_SSL_LOGIN', true);
define('FORCE_SSL_ADMIN', true);

Block Access to Execution – These rules blocks or restricts access to necessary web directories files.

# Deny Directory Listing

Options - Indexes

# Block Sensitive Files

<files.htaccess>
Order allow,deny
Deny from all
</files>

# Block Installation Files

<files install.php>
Order allow,deny
Deny from all
</files>
<files setup-config.php>
Order allow,deny
Deny from all
</files>

Restrict PHP Execution – These rules restrict attackers from placing backdoors to your important folders in your web directory.

# Backdoor Protection Apache (Version 2.2)  

<files *.php>
deny from all
</files>

# Backdoor Protection Apache (Version 2.4)

<filesMatch ".+\.php$">
Require all denied
</filesMatch>

Prevent Image Hotlinking: This rule is essential to save your web server resources. It prevents other websites from using your images hosted on your website.

# Prevent Image Hotlinking

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} \
!^http://(www\.)example.com/.*$ [NC]
RewriteRule \.(svg|gif|jpg|jpeg|bmp|png)$ – [NC,F,L]

Block Include Functions – It restricts malicious or spam files or source codes into folders used for includes.

# Block Includes

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^wp-admin/includes/ – [F,L]
RewriteRule !^wp-includes/ – [S=3]
RewriteRule ^wp-includes/[^/]+\.php$ – [F,L]
RewriteRule ^wp-includes/js/tinymce/langs/.+\.php \– [F,L]
RewriteRule ^wp-includes/theme-compat/ – [F,L]
</IfModule>

Prevent XML-RPC Attacks – If you don’t need any applications or software to connect with WordPress, you can deny access to the xmlrpc.php file.

# Deny Access to xmlrpc.php Completely

<files xmlrpc.php>
Order Deny, Allow
Deny from all
</files>

# Deny Access to xmlrpc.php Partially

<files xmlrpc.php>
order deny, allow
deny from all
allow from X.X.X.X
</files>

Block Information – Although some WordPress guides recommend removing these files altogether, we don’t recommend to completely delete the files.

# Block WordPress Info

<files readme.html>
Order allow,deny
Deny from all
</files>
<files license.txt>
Order allow,deny
Deny from all
</files>

Protect .htaccess – After you have done the hard work, you don’t want attackers to see your hard work in a free environment. So, you need to protect .htaccess from the public eye.

# Protect .htaccess Apache (Version 2.2)  

<files ~ “^.*\.([Hh][Tt][Aa])”>
order allow, deny
deny from all
satisfy all
</files>

# Protect .htaccess Apache (Version 2.4)

<FilesMatch "^.*\.([Hh][Tt][Aa])">
Require all denied
</FilesMatch>

2) Adjust Permissions for Web Directories

As I mentioned above, you need to adjust your configuration correctly to prevent attackers from taking control of your site.

You can adjust these settings directly from an admin panel provided by your hosting provider or through an FTP client.

# Fix Permissions

Permissions for all the directories should be set to 755.
Permissions for all the files should be set to 644.

# Restrict Access to Your Essential Files

wp-config.php file: Set permissions to 600
.htaccess file: Set permissions to 604

These permissions or rules are referred to as View, Write, and Execute, as defined in the Unix Operating Systems.

3) Use Security Headers

These lines of codes are inserted in your .htaccess files.

It helps to prevent your web pages from being opened in external frames or iframes while preventing clickjacking attacks on your website.

These header settings should be carefully implemented and appropriately checked because it’s easy to block web resources without you noticing.

# X-XSS-Protection

Syntax
X-XSS-Protection: 0
X-XSS-Protection: 1
X-XSS-Protection: 1; mode=block
X-XSS-Protection: 1; report=
Code
header always set x-xss-protection "1; mode=block"

# X-Frame-Options

Syntax
X-Frame-Options: DENY
X-Frame-Options: SAMEORIGIN
X-Frame-Options: ALLOW-FROM hxxps://yourchoice[.]com/
Code
header always set x-frame-options "SAMEORIGIN

# X-Content-Type-Options

Code
header always set x-content-type-options "nosniff"

# HTTP Strict Transport Security (HSTS)

Strict-Transport-Security: max-age=
Strict-Transport-Security: max-age=; includeSubDomains
Strict-Transport-Security: max-age=; preload

# Content Security Policy (CSP)

Syntax
Content-Security-Policy: ;
Code
content-security-policy: script-src 'self' https://www.google-analytics.com

# Feature-Policy

Syntax
feature-policy: autofocus 'none'; phone 'none'
Code
header always set feature-policy "autoplay 'none'; camera 'none'" always;

When combined, the above code will look like the settings below – 

## CSP

Header set Content-Security-Policy: default-src 'self';img-src 'self' https://i.imgur.com; object-src 'none';script-src 'self'; style-src 'self'; frame-ancestors 'self';base-uri 'self'; form-action 'self';

## General Security Headers

Header set X-XSS-Protection: 1; mode=block
Header set Access-Control-Allow-Origin: http://www.yourchoice.com
Header set X-Frame-Options: deny
Header set X-Content-Type-Options: nosniff
Header set Strict-Transport-Security: max-age=31536000; includeSubDomains

## Settings End ##

I would recommend you to perform these tests on different browsers and source frames to check for errors and outcomes before implementing these settings on your live website.

Nginx Configurations

 

1) Disable Unwanted HTTP Methods

Allowing TRACE or DELETE is risky as it can allow Cross-Site Tracking attack.

 

if ($request_method !~ ^(GET|HEAD|POST)$)
{
return 405;
}

 

2) Deny Access to .PHP File Extension and Sub-Directories

You should deny direct access to any PHP files.

 

location ~* /(?:uploads|files)/.*.php$ {deny all;access_log off;log_not_found off;}

# Works in Sub-Directory Installs and also in Multisite Network

location ~ ^/(?!(blog)/?) {deny all;access_log off;log_not_found off}

3) Block Nginx-Help Log

You don’t want your logs to be open for public viewing.

 

location ~* /wp-content/uploads/nginx-helper/ {deny all;}location ~ ^/(wp-includes/js/tinymce/wp-tinymce.php)include /usr/local/nginx/conf/php.conf;

 

4) Disable Direct Access to Dotfiles

Likewise, a PHP file, a dotfile many contain sensitive information.

location ~ /\.(svn|git)/* {deny all;access_log off;log_not_found off;}location ~ /\.ht {deny all;access_log off;log_not_found off;}location ~ /\.user.ini {deny all;access_log off;log_not_found off;}

 

5) Hide Nginx and PHP version

This won’t prevent the attack itself. However, don’t let the attacker know your settings.

 

#Hide the Nginx Version

server_tokens off

#Hide the PHP Version

fastcgi_hide_header X-Powered-By;proxy_hide_header X-Powered-By;

 

6) Use Security Headers

It provides an extra layer of browser security.

 

add_header X-Frame-Options "SAMEORIGIN";add_header Strict-Transport-Security "max-age=31536000";add_header X-Content-Type-Options nosniff;add_header X-XSS-Protection "1; mode=block"

 

7) Disable Directory Listing

You never want anyone to know what’s in the directory for most of the time.

 

# Disable Directory Listing

autoindex off;

8) Limit Requests to Logins

This rule will limit the number of requests that the page can handle per second.

limit_req_zone $binary_remote_addr zone=WPRATELIMIT:10m rate=5r/s;location ~ \wp-login.php$ {limit_req zone=WPRATELIMIT;}

9) Deny Access to wp-content Folders

If you think there are some suspicious activities in your database, you can deny access to those files.

location ~* ^/(wp-content)/(.*?)\.(zip|gz|tar|bzip2|7z)\$ {deny all;}location ~ ^/wp-content/uploads/vigorousitsolution {deny all;}location ~ ^/wp-content/backup {deny all;} 

 

You can utilize the Security Headers website to analyze your HTTP response headers for free.

 

Setting headers is relatively quick. You will have a reasonably significant increase in your site security for different attacks on the internet.

WordPress Security Conclusion

As you can see that WordPress Security is a big deal.

So, you can’t ignore the importance of WordPress Security. You need to carefully review the above security checklist and find new ways to improve your website security.

Website Security Mistakes to Avoid

It’s hard to look at every aspect of your website and your business at once.

So, there might be a time that you can make mistakes.

It’s a mistake when you do it unknowingly, but it’s a choice if you repeat the mistakes.

So, try to avoid these mistakes for your website security;

  • Do not make the mistake of “I have a small business, or I don’t sell online, so I don’t need to care about my website security” philosophy.
  • Do not send the data in an online platform without any encryption technology.
  • Do not save your passwords in your browsers. Utilize password management tools instead.
  • Do not be too optimistic. Website security is a never-ending process, so you always need to be active and be ready to search and fix the problems.
  • Do not install third-party software or tools blindly. You should thoroughly get an overview of the products you want to install beforehand.
  • Do not over-rely on website security service provider. It’s not only their responsibility to protect you. You also need to be alert at the same time. They can’t do anything if you do the things they tell you to avoid.

If you have a tight schedule or lack team members to protect your site daily, it’s a wise decision to get help from experts or web security companies.

On the contrary, you can focus more on your business operations while leaving professionals with hard work.

Website Security FAQs

Why do I need web security? There’s nothing valuable on my site to steal.

Attackers don’t discriminate. It doesn’t only infect popular sites. Most cyberattacks are automated, which means you’re as much of a target as anyone.

I don’t need website security now, nothing wrong has happened yet.

Implementing web security is just like locking your home doors. You don’t close the doors because you expect something wrong to happen.

You close the doors because if something did happen, the consequences might be devastating.

Why should I use the website security service?

Think of this as buying a house. When you buy a home, the house comes with doors and windows with built-in locks.

Still, the house doesn’t have additional security like an alarm system, surveillance camera, and other amenities.

After you move into the house, you’ll likely add some kinds of stuff. You may opt to protect your home by installing additional security protocols, and you’ll pay extra for that added security. 

Similarly, as you build your website and add more stuff to it, you’ll want to protect your site by adding another layer of security.

CONCLUSION

As you can see, website security is a big deal. For many of you, your site is your source of income or your business.

So, it’s essential to invest some time and implement some of the security strategies mentioned above.

If you haven’t taken any steps or followed some of the above strategies to secure your website from attacks and vulnerabilities, your site might be at risk.

It doesn’t make sense to cry over spilled milk. So, it’s better to be careful beforehand.

What are your thoughts on website security?

Did I miss some point which you want me to add or update?

Let me know in the comments below.

Share on facebook
Share
Share on twitter
Tweet
Share on linkedin
Share
Rosan Baral
Rosan Baral

Rosan Baral is the Founder of Vigorous IT Solution. He helps brands to extend their business presence in the current markets using strategic business planning and digital technologies.

Subscribe To Our Business Guides

Grow Your Business With Us

Comment Policy: Thank you for stopping by to leave your feedback. We highly appreciate your time.

However, all comments are manually moderated, and those deemed to be spam or solely promotional will be deleted. Your email address will not be published.

4.8 17 votes
Rating for the Article
guest
34 Comments
Newest
Oldest
Inline Feedbacks
View all comments

Want To Boost Your Business?

Drop us a line and we will be at your service to help you grow your business.