Solution to 500 Internal Server Error .htaccess Hacked
-
Problem
You are suddenly experiencing a 500 Internal Server Error on your home page which prevents you from seeing any of your Web site content, and may even prevent you from accessing your WordPress admin console.Argh!!! What’s the answer? Has our Web hosting company gone bust? What on earth is going on? My Web site is completely broken!
Cause
It is possible/probable that your .htaccess is not properly configured – this could be due to A) an accidental typo B) badly written .htaccess file C) a malicious injection hack.Solution
All is not lost! Assuming you’re the victim of C) please try the following:
1) log into your site via FTP (Filezilla, etc.)
2) download a copy of your .htaccess file, rename the copy e.g. “.htaccess-backup”
3) delete the .htaccess file residing on your Web server
4) create a new blank file called “.htaccess” on your PC/laptop/Mac
5) upload this new file to your Web server in the same place as the original .htaccess (which you deleted).
6) navigate to your WordPress admin URL, e.g. https://www.yoursite.com/wordpress/wp-admin, and you should now be able to log in!
7) finally, once logged in, navigate to the Permalinks settings page in the admin console and do nothing further. Simply going to the settings page should enable WordPress to write the correct .htaccess declarations itself.You should now be able to nagivate to e.g. https://www.yoursite.com or https://www.yoursite.com/wordpress (depending on whether WordPress is running your entire site or just a blog etc.) and all should be well once more.
Assumptions
Please note I am assuming you are running a typical/standard WordPress setup with the .htaccess configuration which is bundled with a typical WordPress installation. However, this solution may also work equally well for non-standard setups.Lessons
1) Protect your site from XSS (cross site scripting). WordPress has many safeguards in place, but you should be aware of and take extra precautions against malicious scripts sent in comments or otherwise.
2) If you have a complex .htaccess file (i.e. non standard) it’s well worth keeping a working backup copy offline (which you probaly already do along with the daily/weekly DB and site backups) so you can revert to this in times of future hacking.
3) If possible turn on Apache logging to make better sense of future server errors.Credits
1) https://www.amenext.com/tutorials/how-to-fix-the-wordpress-internal-server-error/While this may not solve all 500 internal server errors relating to a WordPress site (or otherwise), it does appear to be a very common issue and highlights the importance of protecting your site against attacks.
I hope this helps someone.
- The topic ‘Solution to 500 Internal Server Error .htaccess Hacked’ is closed to new replies.