Page 1 of 1
php5 parsing php as html
Posted: Tue Jan 13, 2009 2:13 pm
by isign4jc
I have built a number of sites using some php code within html pages. I didn't want to use the .php extension, so I've added AddType application/x-httpd-php5 .html to my .htaccess file. The thing is, I don't want this to become obsolete whenever the next version of php comes out. Is this possible? I ask because I did have it like this: AddType application/x-httpd-php .html on one site I built and as soon as the hosting company upgraded to php 5, all their pages weren't working anymore. As soon as I added the "5" to it, it worked fine. I have built alot of sites with this already and I definitely don't want to have to go into each one individually to edit the .htaccess each time their host upgrades. Is there a solution for this? Can anyone help me out?
Re: php5 parsing php as html
Posted: Tue Jan 13, 2009 2:23 pm
by jaoudestudios
Why would you not want to use the *.php extension?
Re: php5 parsing php as html
Posted: Wed Jan 14, 2009 11:50 am
by isign4jc
I guess I thought it would be better for search engines or something (do you know i it has any affect on it?). I have my text pulling from a database and then being revealed on those pages using php. Will the search engines still find this text, even though it is dynamically created?
Re: php5 parsing php as html
Posted: Wed Jan 14, 2009 11:57 am
by Mark Baker
isign4jc wrote:Will the search engines still find this text, even though it is dynamically created?
Search engines don't read the PHP source, but the HTML that is rendered by PHP
Re: php5 parsing php as html
Posted: Wed Jan 14, 2009 12:00 pm
by jaoudestudios
isign4jc wrote:I guess I thought it would be better for search engines
Like
Mark Baker said, php only produces html to the browser. So to the search engine it makes no difference *.html, *.php etc...
You're creating work for yourself

Re: php5 parsing php as html
Posted: Wed Jan 14, 2009 12:23 pm
by isign4jc
So you guys think it's better to just create these pages with the .php extension because it's possible that the .htaccess code I have created could become obsolete? Making them .php would definitely take out a few steps for me when I'm creating the website.
Re: php5 parsing php as html
Posted: Wed Jan 14, 2009 12:43 pm
by jaoudestudios
Yep, using the php extension is fine.
Re: php5 parsing php as html
Posted: Fri Jan 16, 2009 9:55 am
by isign4jc
I plan to use the .php extension for any subsequent websites, but is it important enough that I should go back and change what I've done previously with the .html extension to .php? I'm a bit afraid of the possibility of a hosting company upgrading in the future to php 6 and then their site not showing up properly or something. I've done anywhere from 10-15 sites this way, so it would require some work to go back and make these changes, but if it prevents my fear from happening I will do it. Your thoughts?
Re: php5 parsing php as html
Posted: Fri Jan 16, 2009 10:01 am
by Mark Baker
Although to be honest -- given the large number of hosting companies that insist on running PHP4 still rather than upgrading to PHP 5 -- the possibility of a hosting company upgrading in the future to php 6 is likely to become a reality long after I've retired
Re: php5 parsing php as html
Posted: Fri Jan 16, 2009 10:03 am
by jaoudestudios
If what you have done works, then I wouldn't go back and change them. Especially because google has probably indexed them as *.html instead of their true extension *.php. So changing it now could have a decremental effect.
Re: php5 parsing php as html
Posted: Fri Jan 16, 2009 10:18 am
by isign4jc
thanks for all your help!
Re: php5 parsing php as html
Posted: Fri Jan 16, 2009 12:20 pm
by RobertGonzalez
If you have good placement right now on links that link to .html files then you might be in a fix. In that case use a rewrite rule to catch requests to .html extensions and route them to their corresponding .php instead. In general the file extension does not have an impact on search placement. What does have an impact is when you change file extension types (say .asp to .php) and links break. Broken links have a huge impact on search placement so you never want that.
Which is all the more reason to drop the .extension altogether and just use path based urls.