![]() |
Parsing .html as PHP What I want is for my .html files to be parsed as if they are .php I have tried adding to the .htaccess : AddHandler x-httpd-php .html .htm and AddHandler application/x-httpd-php .html .htm and AddType application/x-httpd-php .html .htm The last one actually causes the browser to want me to open it with an application so I know that the .htaccess is being read. I have also tried adding via the cpanel apache handler. But it is not parsing it as .php. So, for example if I use the code: <?='hello'?> It is showing as that in the source code. Any help? Thanks, Ben Shaffer |
Re: Parsing .html as PHP I use this in .htaccess Code: <FilesMatch ".(htm|html)$">Quote:
|
Re: Parsing .html as PHP Thanks. Weirdly, this is causing the browser to ask how to open the file. Any other suggestions? Ben Shaffer |
Re: Parsing .html as PHP Ben - what hosting are you using? I've given the same solutions as above in one of my installation guides for my dynamic link cloaking - as an aside and I've not actually tried it... naughty me! So naturally I'm concerned as it appears it don't work on some hosting servers! I scoured Google on this and there are others ( strangely enough ) experiencing the same problem you are seeing. Some - and I'm only regurgitating what some folk reckon works - suggest the following. Code: AddType application/x-httpd-php .php .htm .htmlI'd contact your hosting techs and see what light they can shed on this.. Let us know what you find! I'd certainly be interested. Cheers Tim |
Re: Parsing .html as PHP Hi Tim, I just bought a site so am currently on their dedicated server with my own cpanel. Not really sure a lot more than that apart from the following pasted from cpanel: Hosting packagestandardServer NamehostcPanel Version11.24.5-STABLEcPanel Build38506Themex3Apache version1.3.41 (Unix)PHP version5.2.6MySQL version5.0.85-community- log Architecturei686Operating systemLinux I tried what you said and it had the same problem - asking which app to open it with. All I really want to do at this point is to use includes from the header and footer. Perhaps there is another way to do this without changing the file extension? Ben Shaffer |
Re: Parsing .html as PHP Quote:
Code: AddType application/x-httpd-php .htm .htmlI don't think you need the AddHandler though. Try it without it. |
Re: Parsing .html as PHP Kirk, Forgive me if I am mistaken, but are you not just repeating what I said in my original thread? B |
Re: Parsing .html as PHP For web servers using PHP as apache module: Code: AddType application/x-httpd-php .html .htmCode: AddHandler application/x-httpd-php .html .htmYou can also try Code: Options +FollowSymlinksCode: Options +FollowSymlinksCode: RewriteRule ^(.+).htm$ http://yourdomain.com/$1.php [R=302,NC]Code: RewriteRule terms.html terms.php |
Re: Parsing .html as PHP If your host is running php version 5, you should try: AddType application/x-httpd-php5 .html .htm |
Re: Parsing .html as PHP Quote:
I've had a very quick "Squiz" over this and it looks like the answer is in there.. WWW FAQs: How do I include one HTML file in another? It would still be good if we can get your PHP issues sorted. Cheers Tim |
Re: Parsing .html as PHP Hey Ben Here's a software tool PhpActivator that will help you out. "O Yeah" it's free PhpActivator Michael |
Re: Parsing .html as PHP Check your PHP version & use appropriate handlers with it version like php3 or php5 |
Re: Parsing .html as PHP Quote:
where you have Code: <?='hello'>Code: <?PHP='Hello';?>Code: AddHandler x-httpd-php .html .htm |
Re: Parsing .html as PHP Quote:
It should be Code: <?php echo 'Hello';?> |
Re: Parsing .html as PHP Quote:
Thanks, Lisa |
| All times are GMT -6. The time now is 04:51 AM. |