Sometimes when we access a URL, it gets downloaded to the local machine where it not meant to be. In such scenarios, you can check the PHP handlers that mentioned in the .htaccess file of your problematic site. First you must know what’s a PHP handler, please continue reading before going to the steps.
A PHP handler defines the method that Apache uses to communicate back and forth with your PHP scripts. In order for a site to run on PHP, the server must interpret the PHP code and generate a page when visitors access the website. It interprets the code based on which PHP library you are using, such as PHP 4 or PHP 5. A PHP handler is what actually loads the libraries so that they can be used for interpretation. PHP handlers determine how PHP is loaded on the server.
- ssh to the server as root user
- Open the .htaccess file under the problematic domain using a text editor
- Please add the following lines at the end of the file then write quit the file and check if the issue gets fixed. Done!!
AddType application/x-httpd-php .html .htm
It may be PHP version specific. If you’re using PHP5 try:
AddType application/x-httpd-php5 .html .htm
RemoveHandler .html .htm AddType application/x-httpd-php .php .htm .html
Now try to access the URL and see if it works for you, thanks!!
- Load Average on Linux and Unix-like Systems Explained - May 16, 2020
- How to Install Webmin on CentOS/RHEL 7/6/5 – Linux - May 16, 2020
- List addon domains, parked domains and sub domains via command line – cPanel - May 13, 2020