Securing WordPress site is a critical for anyone who managing a blog or business site. Plugins are helpful but i do not suggest to go through. the most efficient way is protect your site using perfect setup. Relying many third-party tools can introduce vulnerabilities or slow down your site. If you want full control and best user experience, follow my guide on securing WordPress without plugins or extra tools.
Use A Strong File Permission In File Manager
Incorrect file permissions often give hackers an easy access to your site. they try to inject malware and hacked. To protect this, set the right permission level from your file manager. Folders permission should be 755 and files is 644. Take extra care on the wp-config.php
file beacuse it holds database login details. use the command for terminal access or set above permission via file manager. chmod 600 wp-config.php
This will place restriction who can read and edit on your server.
Block Access To Sensitive Files
There are core files in your hosted file manager don’t require any public access to run your wordpress site. You should block the core files using htaccess rules. For example to stop direct access to the wp-config file and readme files use the follow line in your .htaccess file.
<Files wp-config.php>
Order Allow,Deny
Deny from all
</Files>
This protection will stop bots or unwanted visitors from viewing or downloading critical files. this way you will secure your files and folder. lets continue to protect file editing from dashbaord.
Disable File Editing From Dashboard
WordPress allows editing theme and plugin files from the dashboard which is risky. To stop this ability add the following line in your wp-config filedefine('DISALLOW_FILE_EDIT', true);
This code create protection and protect removes the edit option completely. so even if someone logged in they cannot inject malicious code. your site will be more secure now.
Rename Login URL
The default login URL for WordPress site is known by everyone. It is often targeted by brute force attacks. You can change it by editing the .htaccess
file and using a rewrite rule. also another option is configuring it manually through server tools. now you are under control becasue hacker can’t see login URL. you will not face login attack by hackers.
Secure The Database With Smart Tweaks
Database is the heart of a website. Change the default table prefix wp_
to something better unique. for an example- blog_23_
. So now you are not using default setting. hacker try first time to target through default settings.
You should use a strong database . do not use any common username & password for database. Generally, wordpress default install use a complex username & password which is very secure. For more complex security you can restrict unknown IP visitor. thereafter, clean your old data every week or at least a month . Delete revisions, spam comments, and transients to reduce databsae size and risk. You can run a SQL query likeDELETE FROM wp_posts WHERE post_type = 'revision';
(this is for advance user who understand SQL programming). do not try this unless you know what you are going to do. for necessary case HIRE AN EXPERT to handle this. Anyways, the SQL query will remove old version of revision and reduce your risk.
Clean Your Codebase
You may have unused themes and plugins. Even you deactivated those plugin & themes may be vulnerable. delete everything that not used or not necessary for you. Also check for suspicious code in functions files or uploads folder. another checkpoint is avoid pirated themes & plugins. i saw a lot of people use nulled theme & plugin which is a risk for entire site. They often have hidden backdoors. Instead always download theme from trusted sources like wordpress.org
Manually checking the theme and plugin code helps you spot anything abnormal. Search for eval()
or base64_decode()
which are common signs of injected malware.
Monitor Server Activity
Monitor your server log every week/month or in any change. you should open error log file from file manager and see whats going on. Most hosting plans include access logs where you can spot failed login attempts or unknown IPs. Use this to track suspicious patterns.
For example if you see multiple login tries from a single IP it could be a brute force attack. In such case you can block the IP using your .htaccess
or firewall settings from cPanel.
Top Checkpoints For Maximum Safety
Here is a quick list that can help you for better security
- Check file permission.
- Clean up old database entries. (do not delete or apply any SQL query unless you are an expert)
- Rename admin URL and login paths
- Keep WordPress core updated. (every time wordpress update available just intall that update)
- Avoid public write permissions on folders
- Review code for suspicious functions
- Backup your data regularly using host provider tools in Cpanel.
By securing WordPress without a plugins you take full control over site protection. The site will be faster and you depend less on the external code. These steps are simple but powerful whenever you apply it correctly. The best part is you will be able apply the above all things even you are on small hosting plans. no need extra cost or server upgrades. I belive if you focus on the described security matter your site never hacked or injected by hacker. should you have a question in mind? don’t forget to drop a comment below.