Apache: AddType not working | change extension of php files

Change php extension

If you want to change extension of php files (for example use .php5, .phtml or even .html), use the following apache directive:

AddType application/x-httpd-php .html .php5 .phtml

You can customize it (add all extensions you want, not only the one listed above) and put it in a .htaccess file or in your httpd.conf file.

AddType not working

If putting your AddType directive into a .htaccess file is not working (ie. apache is not calling php to parse the file), it may be because you have an

"AllowOverride None"

directive declared in your httpd.conf file. Turn it to

"AllowOverride All"

if you have access (don’t forget to restart Apache too: “sudo /etc/init.d/apache2 restart“). Refer to the following post for more info: .htaccess not loaded

sources

Post a Comment

Your email is never published nor shared. You're allow to say what you want...