Hi,
Can I use a php tag in a normal HTML file. By this I mean that the file that will be outputted to browser will be a .html file and not a .php file. However, that html file might comprise some <?php?> tags
Please help!!!
Thanking You in advance,
Kind Regards
Pratik
PHP tags
Moderator: General Moderators
- dibyendrah
- Forum Contributor
- Posts: 491
- Joined: Wed Oct 19, 2005 5:14 am
- Location: Nepal
- Contact:
Yes you can do that with the apache configuration. If you want to parse PHP tags within the plain html file, you just have to edit configuration file of apache web server.
Just add following line in your httpd.conf file.
OR
Try any of the above lines.
Just add following line in your httpd.conf file.
Code: Select all
AddType application/x-httpd-php .htmlCode: Select all
AddHandler application/x-httpd-php .htmlPHP tags
Hi Dib,
The solution provided by you worked on my machine. However one doubt.
Since I have apache installed on my machine, I changed the httpd.conf file and things got worked.
But what if I have an ISP who host web sites on an Apache server?
In that case, I will not have any control over the httpd.conf file of the ISP.
I will give the ISP only the pages of my website??
Will that work in that case??
Thanking you in advance
Kind Regards,
Pratik
The solution provided by you worked on my machine. However one doubt.
Since I have apache installed on my machine, I changed the httpd.conf file and things got worked.
But what if I have an ISP who host web sites on an Apache server?
In that case, I will not have any control over the httpd.conf file of the ISP.
I will give the ISP only the pages of my website??
Will that work in that case??
Thanking you in advance
Kind Regards,
Pratik
- dibyendrah
- Forum Contributor
- Posts: 491
- Joined: Wed Oct 19, 2005 5:14 am
- Location: Nepal
- Contact:
That can be done using .htaccess file.
Look for the file named .htaccess in your public_html folder. If it's not there, using text editor and save it as .htaccess
Now add the the following lines:
This should work !
To learn about .htaccess file, refer to this page :
http://httpd.apache.org/docs/howto/htaccess.html
Best,
Dibyendra
Look for the file named .htaccess in your public_html folder. If it's not there, using text editor and save it as .htaccess
Now add the the following lines:
Code: Select all
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .htmlTo learn about .htaccess file, refer to this page :
http://httpd.apache.org/docs/howto/htaccess.html
Best,
Dibyendra