If you are using Wordpress, and your index.php file has been hacked, there are just a few easy steps you can do on your own to immediately repair your web site.
This article was written under the assumption that you don't have any backup files. If you do have backups, please instead see How to restore files from backup if you have a copy.
If you don't have any backup files, you can download a fresh copy of WordPress and use the index.php files included in the download. To make things easier, in the steps below we've linked directly to the files that you'll need.
- Begin by accessing your cPanel and locating the File Manager icon.
- Select the domain from the "Document Root for:" drop box. Click Go.
- Select your index.php file and choose "Edit" from the top menu bar of File Manager to open the file for editing in a new tab
- Select all (Ctrl+A) and delete the contents of this file.
- Copy and paste the code below from this file to replace the original Wordpress code:
WordPress index.php file
- Save your changes to this file
- Reload and test your site. If you do not immediately see the changes, you may need to clear your broswer's cache.
The steps above cover fixing the defacement of your site's homepage. You will next want to repair the index.php page in your admin area.
- Back in the File Manager of cPanel, find the wp-admin folder and double click it to open that folder.
- Find the index.php inside the wp-admin folder. Select the file and open it for editing by choosing "Edit" from the top menu bar of File Manager.
- Select all (Ctrl+A) and delete the contents of this file.
- Copy and paste the code from this file to replace the original Wordpress code:
WordPress wp-admin index.php file
- Save the changes to this file.
- Your site's WordPress admin area should now be available and you should be able to log in.
The steps above should remove any hacked content for this situation. If you have any questions or need additional assistance, we are available 24 hours a day via phone, chat or email.
We value your feedback!
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
new! - Enter your name and email address above and we will post your feedback in the comments on this page!