php5 parsing php as html
Moderator: General Moderators
php5 parsing php as html
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?
- jaoudestudios
- DevNet Resident
- Posts: 1483
- Joined: Wed Jun 18, 2008 8:32 am
- Location: Surrey
Re: php5 parsing php as html
Why would you not want to use the *.php extension?
Re: php5 parsing php as html
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?
-
Mark Baker
- Forum Regular
- Posts: 710
- Joined: Thu Oct 30, 2008 6:24 pm
Re: php5 parsing php as html
Search engines don't read the PHP source, but the HTML that is rendered by PHPisign4jc wrote:Will the search engines still find this text, even though it is dynamically created?
- jaoudestudios
- DevNet Resident
- Posts: 1483
- Joined: Wed Jun 18, 2008 8:32 am
- Location: Surrey
Re: php5 parsing php as html
Like Mark Baker said, php only produces html to the browser. So to the search engine it makes no difference *.html, *.php etc...isign4jc wrote:I guess I thought it would be better for search engines
You're creating work for yourself
Re: php5 parsing php as html
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.
- jaoudestudios
- DevNet Resident
- Posts: 1483
- Joined: Wed Jun 18, 2008 8:32 am
- Location: Surrey
Re: php5 parsing php as html
Yep, using the php extension is fine.
Re: php5 parsing php as html
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?
-
Mark Baker
- Forum Regular
- Posts: 710
- Joined: Thu Oct 30, 2008 6:24 pm
Re: php5 parsing php as html
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
- jaoudestudios
- DevNet Resident
- Posts: 1483
- Joined: Wed Jun 18, 2008 8:32 am
- Location: Surrey
Re: php5 parsing php as html
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
thanks for all your help!
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: php5 parsing php as html
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.
Which is all the more reason to drop the .extension altogether and just use path based urls.