Posted in:

How To Secure Your Website From Hackers

People get websites for various reasons. The reason ranges from been a means of relationship with clients by organizations to passing across information and earning income. Putting up a website allows people from anywhere in the world to be able to access the website. It therefore, comes with attendant risk from people with malicious intent from every part of the world as well. Knowing how to secure website from hackers will go a long way to ensure that your website is not hacked into. This is considering that hacker activities could lead to your website getting temporarily unavailable, user information (including sensitive ones like credit card details) could be stolen and the information on your website could even be changed. Some important ways of securing your website from hackers will be discussed.

Use of website security tools

how to secure website from hackers

There are several free and paid security tools for websites that will come in handy if you are wondering how to secure website from hackers. They are able to detect and stop malicious script that hackers can use to access websites including most SQL injection methods. If you are working on budget and cannot afford a paid website security tool, there are a number of free ones you can get. Prominent among them are Xenotix XSS Exploit Framework,, OpenVAS and Netsparker.

Xenotix XSS Exploit Framework

The Xenotix XSS Exploit Framework is an open web application security project (OWASP) tool that entails a large quantity of examples of XSS attacks. You can run them to check if the inputs on your site are vulnerable with Internet Explorer, Firefox and Chrome. is an online check that is free and can be used to find out HSTS, CSP and other security headers that have been correctly configured and are enabled.


OpenVAS is a security scanner that is open source. They are reputable for scanning more than 25,000 vulnerabilities that have been discovered. You will however, need to install a OpenVAS server and other process of setting it up, which could be a bit expensive. Netspaper is a great tool for XSS testing and SQL injection testing. With these and other tools, you will be able to get results from the automated tests. A number of potential issues will be identified. You can start by taking care of the critical issues first. Other low or medium issues might not be applicable to your website. If you can afford it, there are a number of paid tools that are very effective that you can also try out.

Use of Security Certificates

how to secure website from hackers

With a security certificate, it is possible to add the HTTPS protocol to your website. The HTTPS is a means of indicating to users that the server they are communicating with is the right one and that no one can change or intercept the information they are sending to the server.

If you run a website that you expect users to enter private information, it is best that you activate the HTTPS protocol on your website. Security conscious users will also know to look out for this feature before entering private information including login details and credit card to your website. While you can buy SSL certificates to activate the feature, there are some online services that also allows individuals access to automated and free certificates that is required to activate the feature on their website.

You will also get an added benefit of higher website ranking when you have HTTPS feature on your website. It has therefore, recently become another way to optimize your website for search engine (SEO).

Stay up to date

how to secure website from hackers

Another thing you can do if you are concerned about how to secure website from hackers is to stay up to date on hacking techniques and methods. Ensure that you read about ways hackers use to get access to websites, as well as security vulnerabilities on websites. With this, you will be able to be ahead of them and put in measures to avoid such loopholes on your site.

For this, you could register on security websites where how to secure website from hackers are extensively discussed. They will send regular mails to your website on how hackers operate, things that could make your website vulnerable to an attack as well as how to protect your website from hackers. The information you will get from here, if properly implemented will go a long way to make your website much safer from the activity of hackers.

File uploads

One of the most utilized methods by hackers to get access into websites is through file uploads. When you have a website where users have to upload files, even if it is just images that they are allowed to upload, a huge number of vulnerabilities that could be easily exploited by the hackers immediately open up.

The hackers could upload a file that contains a script to your website. Once they are able to run the script, your website will be completely opened up to them. They will subsequently be able to get any information they desire from your website or carry out other destructive activities.

For security reasons, you should consider every file uploaded to your website by users as a threat. Using file extension only as a measure to check vulnerable files could be a big fail, since the file extension can be renamed or mimed to give a false appearance. Reading of headers and opening the file as well as checking size of image can also be misleading. This is considering the fact that a lot of formats for images allowa section for comments. It is possible for hackers to hide PHP scripts in this comment section. Execution of the code will subsequently lead to vulnerability on your website.

Furthermore, it is possible for hackers to put another file extension in between the file name and real extension to give a false sense of image type. For instance, a php script could be renamed as picture.jpg.php, which will make the server identify the .jpg extension. An attempt to open the image could lead to the execution of the script and subsequently, an attack on the website.

A step on how to secure websites from hackers in this regard is to either rename the file once they are uploaded to the right file extension. It is also possible to change permission to make sure that uploaded files cannot be executed. You can also utilize a .htaccess file that will ensure that users can’t upload a file with double extensions like the .jpg.php example above.

The best option is however, to ensure that users don’t have direct access to any file they upload to your website. Set uploaded files to be saved to other folders outside the root of the web or to be saved as a blob in a database. You will subsequently have to develop a script that will fetch the files from a private folder. Setting up a firewall to block every port that is not essential is also effective. Public access should only be set to port 443 and port 80.

Username and Password

how to secure website from hackers

The most vital information that hackers require in their activities is usernames and password. A lot of their techniques are, therefore, directed towards obtaining this information from website owners and users. In line with this, it is very important that the username and password to your website server and administrative area is very strong. The use of a combination of alphabets, numbers and symbols is usually encouraged. This will make it more difficult for hackers to guess or break your password. It is very much advisable that you have a unique username and password for very important online accounts such as the one for your account. Using the same username and password of one or more online accounts as the username and password to the administrative area and server of your website, could be risky as hackers could try the information of a user they found on a website on other websites, and if they find that the individual have a website, they could also try to use it to access their sites. In line with this, use strong username and passwords and change them regularly.

Relatedly, you should also encourage users of  your website to also use unique and strong username and password on your website, to avoid unauthorized access to their accounts on your website. You could set the password feature on your website, especially if users are expected to enter very sensitive personal information, to include an uppercase letter, a lower case letter, a number and a symbol, before they are authorized. You should also ensure that you save their account details securely on your website. The use of hashing algorithm and salting every password with a new salt could help secure their accounts as well.

SQL Injection

The use of SQL injections is another way hackers can attack your website as they can use a URL parameter or web form field to manipulate or access your database. Rogue codes can be unknowingly added to your query when you apply the Standard Transact SQL. With this, data could be deleted, accessed or tables changed. Using queries that are parameterized is the best way to avoid this problem.

Update software

how to secure website from hackers

One of the major reasons why new versions of software are released is when security vulnerability has been discovered in the former version. With this, a new version will be released to take care of the vulnerability in the previous version. In line with this, it is vital that you make conscious efforts to regularly update software you use on your website. Some of the software you will be using on your website that will require updates include forum, CMS or server operating system amongst others. Where possible, allow the updates to be carried out automatically or that you are able to receive a notification the instance a new update is released by the website owners.

Disable auto-fill format on your website

Users sometimes access their account on public computers such as in a café or in their school or office ICT room. With auto fill feature, users can easily get access to their login information and subsequently access their account. Furthermore, people lose their computers and phones on a daily basis, and sometimes, they could be stolen by hackers who want to access their accounts or by other thieves that might subsequently sell them to a hacker. The auto fill feature will therefore give the information of the user to the hacker on a platter of gold.

Back-up your website regularly

how to secure website from hackers

Another security feature that will be useful for you if other how to secure website from hackers you have implemented fails you is the use backing up your website regularly. There are instances where websites are hacked and all the content on the website deleted. In other cases, you might not know how much change in information, structures and even scripts have been carried out on your website in the event of an attack from hackers. It will be easier for you to get your website back on track almost immediately if you regularly update your website. If your website was deleted by the hacker, you can quickly restore the back-up files, block the loophole the hacker exploited and then your website will be live within some minutes or a few hours. If you also notice that some major changes have been carried out on your website or you don’t know the extent of damage, you could delete every existing file on your server and re-upload the backed up version. You should back up your website at least once every week, even though a daily or hourly update will be the best.


Keeping your website secured will be of immense benefit to both you and users of your website. In line with this, it is important to know hackers operate, read about website vulnerabilities and ensure that such vulnerabilities do not exist on your website. Updating software on your website and regular back up are some of the ways to ensure that your website is considerably safe from hacker attacks.

Leave a Reply

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