Welcome to WebmasterWorld Guest from 188.8.131.52 , register , free tools , login , search , pro membership , help , library , announcements , recent posts , open posts Become a Pro Member
Can I run PHP on static pages? sun818
Is there a way with Apache and .htaccess to run PHP on top of static HTML pages? 99% of my site is currently static, but would like to add some additional text based on referrer domain. Like if the link is from a forum posting, I could write "Thanks for visiting from the widget forum". If this is possible, is there a processing load on the server that the web host might not like?
This in your Apache config should enable PHP on all .html files.
AddType application/x-httpd-php .html
It will have some impact on server performance, since every .html files will have to be parsed. Maybe you can add it just for individual files by using <Files ...> sections.
You will also loose some HTTP headers that the default handler in Apache sets based on the file sent. This is stuff like Last-Modified etc.
So, it should be doable, but it will have a pricetag.