Php – How to render a .phtml file through apache

.htaccessapachePHP

I want to render a .phtml file through Apache, however when I try, it renders the page as text and not as html.

In my vhost configuration, if I try to render an index.php, it executes properly. But when I change the DirectoryIndex to index.phtml and try to render the index.phtml present in the public directory it just renders text.

The vhost Config is:
code
ServerName parminder.com
DocumentRoot "C:/workspace/parminder_local_net/public"
ErrorLog logs/parmindercom.log

Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all

DirectoryIndex index.phtml
*

What else do I need to configure for this to work? Do I need to use .htaccess?
What is the basic concept?

Best Answer

htaccess file root folder --> folders -->html pages & subfolders

Try adding this to it:

AddHandler php-script .php .php5 .php4 .php3 .html .htm .phtml

Related Topic