I need to have some specific pages with the .ht file configured so it can read the PHP code in existing HTML pages without having the need to renaming or changing its extension.
How do I implement this when my site is configured by some CMS, and has what is called “clean” URL structure, i.e. all pages have URL’s ending in “/” instead of .html, like ForceType application /x-httpd-php?
Sever is on shared Apache hosting.
CMS question PHP Code related
Apache hosting comes by default configured for the PHP files that only end with the extension .
So a file with .ht extension you can use the following thing for those type of servers that are configured using apache php module
-
AddType application/x-httpd-php .html .htm.
-
Following are two more handlers that you can use in order to achieve the required goal.
-
Use AddHandler cgi-script .html .htm for a server with normal configuration.
-
Use AddHandler fcgid-script .html .htm for a server using FASTCGI approach.
Sometimes you can receive internal server error if you are using a specific hosting because there might be a possibility that they don't support the php_value or php_flag to be changed in .ht file despite the fact that your code and syntax is perfectly valid.