Search code examples
php.htaccess

Why am I getting a 404 error at HostGator or why can I no longer call PHP from within HTML files?


I have a problem related to calling PHP from within HTML files at HostGator. Suddenly, the site was giving a 404 error on my primary page, INDEX.HTML. After some troubleshooting, I realized that it was because the AddHandler statement in the .htaccess file was no longer being recognized. I commented it out by using a "#". Doing this avoided the 404 error for the INDEX.HTML page, but the page didn't display anything that was dependent on a call to PHP. This is the commented-out statement in the .htaccess file. The front line support folks were unaware of any change on the servers.

#AddHandler application/x-httpd-ea-php74 .php .php7 .phtml .html .htm

By the way, my .htaccess file is located in the PUBLIC_HTML folder.


Solution

  • As it turns out, after 10 days HostGator informed me that they indeed upgraded from PHP-74 to LS-PHP-74 (Lite Speed). They had not informed their front line support after they made the upgrade. A different AddHandler statement was required in .htaccess.
    Original Statement:

    AddHandler application/x-httpd-ea-php74 .php .php7 .phtml .html .htm
    

    With LS-PHP-74 the statement has to be modified to:

    AddHandler application/x-httpd-ea-php74___lsphp .php .php7 .phtml .html .htm
    

    That allowed PHP to be called from within HTML files again.