Secure and Speed-up your custom site using the WordPress core


WordPress

This article describes a way in which we can secure and accelerate non-WordPress sites, SaaS applications and other custom websites using WordPress. The original site remains unchanged, visitors and users will not notice any difference.

The pros and cons of WordPress

WordPress, I have had a love-hate relationship with it for years. I hated it because:

  • These sites are always a target for hackers because they are very common and have a standard structure.
  • Updates always occur at the most unfavorable moment. Certainly, we cannot leave security updates behind for too long.
  • They do not provide custom options. WordPress is mainly suitable for weblogs and standard websites.
  • They take a lot of disk space and are sometimes slow. A lot happens under the hood before a page is shown.

However, I also like WordPress for the following reasons:

  • It is free.
  • There is a large group of active developers who keep the system up to date.
  • Almost all common user functions are already included as standard.
  • There are tens of thousands of themes and plugins with which you can do a lot.
  • There are millions of WP websites, it is indispensable.

Moreover, more and more of the mentioned problems are solved, making WP a stable and pleasant CMS.

Custom- and other Non-WordPress solutions

In the past 20 years, I have designed and built many websites. In 50% of the cases, I used WordPress for that. Occasionally I bought a standard solution. For example for a Dating Website or a ticket system for a help desk. However, sometimes my ideas were so different that I had to build a site or app with PHP. In that case, I also had to program or implement scripts myself.

Combining custom websites with WordPress

Last week I thought it would be nice if you could use the WordPress core to secure and accelerate your custom websites. WordPress has a lot of security and caching plugins. They can be installed at the touch of a button. In addition, they are easy to set up and configure from the standard dashboard. The end result would be a win-win situation.

Investigation of the possibilities

The second Corona weekend I faced a number of choices. 1. Do the garden and cut the hedge. 2. Painting the stairs or 3. Testing whether customization and WordPress can be combined. Well, the choice was obvious.

For this project I chose www.webmasterslookup.com. That’s one of my older custom websites that once had PageRank 5 and still attracts quite a few visitors. Main technical features of this site are:

webmasterslookup.com(opent in een nieuwe tab)

  • It is built up with frames.
  • Programmed entirely with PHP and MySQL, which is an excellent platform for WordPress.
  • Link with Google analytics.

Sometimes I noticed that webmasterslookup.com was used to send spam mail. Then I stopped that by modifying the mail script. Furthermore, I had absolutely no idea whether the site was attacked or misused to spread malware. www.webmasterslookup.com seemed to be the ideal test candidate.

Install new WordPress environment on an active custom website

Step 1. Choosing the right approach

At first, I did a few reflections and experiments to determine the best approach. Did I have to install WP in a separate folder? Or did the original website have to run in a sub-directory and WP in the root directory? Or did both have to run in the root directory? In the end, I chose the latter option because I wanted to have all the WordPress features available for the entire website.

Step 2. The preparation

We have to perform the following actions on beforehand.

  1. Full Backup of the original site.
  2. Checking and adjusting the names of PHP files. This mainly concerns the PHP files that are in the root directory. To avoid confusion with WordPress files, they should not start with “wp”. This also applies to XMLRPC.php. Rename these files and test if the site still works.
  3. Install WordPress with FTP in the root directory, but DO NOT UPLOAD INDEX.PHP yet!
  4. If possible, you can temporarily put the site in maintenance mode.
  5. Rename the index.php of the original site to a temporary name. At that point, the website is temporarily not available.
  6. NOW install the INDEX.PHP of WordPress with FTP in the root directory.
  7. Start index.php and follow the WordPress installation steps, such as filling in the database attributes.
  8. You can change index.php back to the index.php of the original website.
  9. If necessary, remove the maintenance mode of the website.

Step 3. Check the effect of step 2

WordPress is now running on our site and you have to check that everything is still working.

  1. Can you call the original site?
  2. Are all functions and screens still working?
  3. Are visitors not aware of the presence of WordPress?
  4. Can you login with wp-login.php?
  5. Check the .htaccess file. Are the lines of the original website still there? Do you see the additions of WordPress? The plugins that you will install later often relate to the .htaccess file. That’s great because then that relates to the entire site. Be careful with this file, check it and make a copy regularly.

Step 4. Set up WordPress

Since you are not going to use WordPress as a front end of a website, you do not need everything that you have installed by default. It is better to remove these things, then you will not take them as ballast for the rest of the site’s life.

  1. Remove all plugins from the new WP install.
  2. Delete all themes except one.
  3. Delete all posts.
  4. Enter an empty home page and delete all other pages.
  5. Choose in “Settings” – “Reading Settings” for a static page, namely home. Then you will neatly return to the website when you log out.
  6. Installing the “rename-wp-login.php” plugin gives unwanted results and is not possible. Therefore choose another username and a difficult password for admin at least.

The website is now ready to be secured and speed up. Just be sure to check the .htaccess file during the project from time to time and see if everything is in order.

The WordPress Plugins we will choose

To choose the right plugin I always use a few golden rules:

The creators of this kind of plugins will not let their product down so quickly. They have a responsibility to their users. Moreover, it is their income.

Most plugins can be configured using checkboxes. I will indicate that if we need to make changes or if something is important for this case.

Security measures

Step 5. The Security Backup plugin

Something you have to do regularly is make a backup of your website. In this case, I tested whether my standard backup plugin is suitable. And that is not the case. After all, you not only need to backup the WP files but also all other files and folders of the website. The same also applies to the tables in the database;  you also need to backup the tables of the original site. It took some time to find a plugin but I ended up with Xcloner. You can make a full backup with it by NOT ticking all the checkboxes. But it is not necessary to backup the WP-file, you can always download them again. Note that “Backup only WP tables” must be set to “off”.

Further more I had to choose a high compression because Webmasterslookup runs on a Lite-Hosting environment.

Step 6. Keep WordPress and plugins up to date

Keeping the WP environment up-to-date can be automated. This is important because old software can contain breaches. WP plugins and theme files should always be updated as soon as possible. But NOT the WP-Core Files. These updates must be updated manualy. Because the update will overwrite the index.php. So when a core-update is done, we immidiately have to restore the original index.php.

I use the “Easy Updates Manager” plugin for this. In this case, you can check the plugin, theme and translate checkboxes to minimize the maintenance time. But remember to keep WordPress Core Updates on “Manually Update”.

Step 7. Sucuri hardening of your website

The Sucuri plugin controls a large part of your security. For www.webmasterlookup.com I ticked some extra checkboxes:

  • Enable Diff Utility.
  • Block PHP in several wp directories.
  • Avoid information leakage.
  • Disable plugin editor.
  • Disable theme editor.
  • Activate Automatic Secret Keys Update.

Because I am a user of www.hackfence.com, I entered the HackFence e-mail address as the destination for the alerts. HackFence can handle that and you don’t have to worry about it anymore. You can also enter your own address. You can opt for a few extra alerts:

  • Integrity checks.
  • Available updates.
  • Password guessing attack.

But turn off “Activation of a new theme” as an alert.

Step 8. WordFence Firewall plugin

This is one of the most important and best security plugins I know. Again, I have the alerts mailed to www.hackfence.com. Tick the following checkboxes:

  • Enable Auto Update.
  • Brute force protection.
  • Optimize firewall.
  • You can set other fields of your choice.
Don’t forget to set the Firewall to Enabled

Regarding scanning, you can leave most checkboxes as is. Important is the following: “Scan Files Outside your WordPress installation” must be enabled. Then the plugin regularly scans for malware on your site. The files of the original site are also scanned in this way!

Optionally, you can enable the Performance option “Use low resource scanning” to avoid delays on your site.

The first scan of your site immediately reports that index.php has changed. That’s right because you did that in step 2, which was a restore from the original website. With this notification you can click on “Ignore changes”, then it will not come back.

After a while, check out “tools” to see if there have been any attacks.

Again, WordFence has modified your .htaccess file ..

Speed ​​up your original website

I installed 2 plugins for this, but there is a wide choice of plugins you can use.

Step 9. Optimizing the database

You must regularly optimize the tables in your database. Superfluous records are then cleaned and the indexes neatly lined up again. This not only strengthens the integrity of your website but also makes it faster. After all, the data is found faster. I always use the plugin “Optimize Database after Deleting Revisions”.

The extra checkboxes you can tick for your website are:

  • Optimize InnoDB tables too.
  • Optimize all tables (So leave all checkboxes unticked). In this way, you also optimize the tables of the original website.

Step 10. Caching!

With the right caching plugin you can accelerate your website enormously. You have to realize that caching ensures that you store pages between your server and the visitor in all kinds of places. Also in the browser. This makes caching less suitable for dynamic websites on which the data often changes. The user can be presented with outdated information.

Speed-up by Caching

For www.webmasterslookup.com I choose the wp-fastest-cache plugin. I have had good experiences with this and it is easy to set up. Enable all checkboxes except the Mobile checkbox.

How long did this implementation take?

I spent 2 days on this entire project. But that also includes the research and selection of the plugins. Moreover, I hadn’t looked at Webmasterslookup in years and had to clean and straighten that website too. All in all, you should be able to do it in one day. If you find it too much work or don’t feel like doing it yourself, I can do it for you.

Satisfied with WordPress

6 Plugins that do the trick

I’m glad I took this step and consider implementing WordPress on even more websites. By installing WordPress with 6 plugins my site is now safer and faster than ever since June 5, 2005. In addition, I have a great backup and optimization of my tables. Yes, I am a satisfied person. In fact, I offer webmasterslookup.com for sale! I will seriously consider reasonable bids …

Contact me thru LinkedIn, my profile is https://www.linkedin.com/in/wimhoogenraad/

LinkedIn GroupDiscussieer mee op LinkedIn.
Samenvatting
Secure and Speed-up your custom site using the WordPress core
Artikel
Secure and Speed-up your custom site using the WordPress core
Beschrijving
This article describes a way in which we can secure and accelerate non-WordPress sites, SaaS applications and other custom websites using WordPress. The original site remains unchanged, visitors and users will not notice any difference.
Auteur
Publisher Naam
ITpedia
Publisher Logo
Sidebar