About a month ago, HostGator upgraded cPanel, which caused the following code to be added to every .htaccess file in every directory:
This instructs the server to parse any PHP code that it finds in pages with extensions .php, .php7, and .phtml. It also means that pages with any other extension will not be checked for PHP code. Since this site's pages have .html extensions, PHP code stopped being parsed and the site broke. I had to modify the AddHandler statement to include .html to restore service.
Code: Select all
# php -- BEGIN cPanel-generated handler, do not edit # Set the “ea-php74” package as the default “PHP” programming language. <IfModule mime_module> AddHandler application/x-httpd-ea-php74___lsphp .php .php7 .phtml </IfModule> # php -- END cPanel-generated handler, do not edit
It seems that HostGator has some automated process that checks every .htaccess file once a week to see if the code block is present. If it's been altered, it removes the altered code and puts back the original code. "Do not edit" isn't just a suggestion! You cannot edit this code; HostGator will revert your changes every week. That means that the site stops working every week, and I have to fix it every week.
I talked to Tech Support twice and they created a ticket the second time. The response from the ticket was that I should change my site password to prevent hackers from editing my .htaccess file. I tried to reply that I haven't been hacked by anyone but them, but the ticket was closed. It's more or less impossible to talk to a live agent, and it's pointless to do so because they're so unqualified. I literally had to explain to the last agent what a .htaccess file is!
Put simply, HostGator no longer allows websites to embed PHP code in files with any extension other than .php. They're going to keep breaking the site every week, so I had to find a new web host. There will be some service disruption while I switch hosts.