Let’s start with a scenario: You wake one day and you see the horror of horrors; your site has been hacked. What can you do assuming that you don’t have a backup? Well, there’s really no need to be worried about. The situation can actually be resolved pretty fast.
As the title says, we are assuming that your website is HTML based, so it’s not running on WordPress or any other CMS that has PHP too. This is very important! I that is the case, this solution is not for you, there are better for that.
The way you can restore the website is pretty simple. You just log into your web hosting account and then go to your control panel choose the domain in question (if you have several of them). Now here comes the fun part…
The File Manager Comes to Help
So you are in your control panel. Now you have to find your File Manager and click on it. A pop-up will show up where you can select from different directories (at least in cPanel). In our case you have to select the web root. Once you’ve done that, you will see all the files associated with your site.
Find the Hacked File(s)
Now it’s time to actually meet the bad guy – find the file that is responsible for the hacked part.
So for example if your homepage has been hacked, you have to look for index.html, open it by “right click”->”edit” and voila, it’s packed with hacked code. This brings us to our next step. But before that, delete the bad code.
Time for the Big G to Step Up
From here on, we are going to rely on good old Google. We do it anyways right? 🙂
Maybe I should have mentioned this earlier, but there is a risk of losing content with this method. Since we are going to use the google cache of the site, it is better to do a check on the last caching date – if it’s not fresh enough, so you modified the content or the site itself since that, then those modifications will be lost or you can even wreck the whole site if the site itself was modified, not only the content.
So you have to find the cache of your page that has been affected by the hacker action and do a right-click above the cached page. Now select “View Source Code” and if you are lucky, you are viewing your site before someone decided to do something funny and hack it.
We almost need all of this code to be copied to our file that we opened previously in our cPanel, but there is a part that we don’t – the cached page has a header which shows the caching date and other info by Google. We need to remove that from our code after we pasted it. So you have delete that part. It starts with <!DOCTYPE html>and you will want to look for a second (or xhtml, depending on your template (if it uses HTML5 then it is the one with !DOCTYPE) This is the start of your site, so the second should be included.
Save the file and that page should work like before. Repeat this process with all other pages that were affected.
Original idea by Inmotionhosting.