I have the option to create my pages in either html, htm or php. I usually just use html or htm as my page extensions but recently I have found that some dynamic content prefers php for the scripts to run properly so I am seriously considering doing new sites in php & even changing one of my old sites over to php. Now I guess my main questions are this: 1) To do php extenstions can I just do a normal html page & then save it as .php? Or does the code need to be different? 2) How do the search engines feel about php do they treat it the same as html? 3) Lastly is there any negatives you can think of doing sites in php instead of html?
If you know how, do it in php. You would be foolish to do it in html especially if you plan on a big site. By now every search engine worth its salt reads php just as well as html.
1) Yes, you can just name a regular HTML document with .php or .phtml without having to change the code... But if you then add php code it will be recognised as such! 2) Yes should be picked up just the same 3) Not that I can think of Bill
Thanks Bill, just to make sure you are saying that I CAN rename a standard html file with the .php extension and it will run as php and I will be able to run php scripts inside the code? Thanks
1) To do php extenstions can I just do a normal html page & then save it as .php? Or does the code need to be different? You can do a normal html page & then save it as .php 2) How do the search engines feel about php do they treat it the same as html? if u use php, it will be rendered as html in the browser.. so no difference. 3) Lastly is there any negatives you can think of doing sites in php instead of html? Nothing...
If the pages are already indexed, I wouldn't change the extension as it won't be the same page. If you want to add php code, you can do so easily on any page extension. If you haven't already just open the htaccess file in the root and add AddType application/x-httpd-php .html .php .htm
Ok good advice there, so it would be a waste of time and effort changing an existing site into php. Appreciate the time saving advice there. So what you are saying is add this line of text to the htaccess file: AddType application/x-httpd-php .html .php .htm And that will allow me to run php scripts within the html of a .html page? Thanks
Absolutely, This site has a ton of php includes on it (Like include_once ('footer.php);, etc) to make it easy to update but notice the extensions. I know php but sometimes I like using it for just includes on an css driven html site It all depends on your level of knowledge
One last thing....You can check with your host to make sure they support PHP but to be honest it would be rare if they didn't (and in fact it would mean it was a pretty bad host and you should switch) Try a bit of php on one page and post back in this thread if you have any issues Cheers
That's very true - if your pages are alreay indexed and you change the file extension the SEs will see them as different pages. If you do change extensions (for whatever reason) you can keep the old page ranking by using 301 redirects...
Developing a site in php with mysql is amazing. If you are planning on developing a large site with a database I recommend php with mysql.
Ok yeah. So I guess another question would be is there any reason at all why other people don't just save there html as .php for future options? Why do most people stick with .html? For future sites I can see saving the extension in .php is much better but are there any negatives? If not (as one poster said there isn't) why does't everyone save as .php and have all their site in this language?
You can just write 1 line in your htaccess file to make html pages parse as if they were php pages. Even html sites can run php scripts so it really makes no difference.
Some of us (unfortunately) are still a bit old school and use html with php in it for fairly simple sites. I would agree though if you are creating a completely dynamic site its best to just go with .php from the beggining.
Yeah thanks for that I did think that was the case. So cool I know what I need to do now you've been very helpful
One thing to consider; if you run everything through the PHP parser/interpreter, you are increasing the load on the server. For a high volume site, this could be significant. FWIW, gary
If you just need to include PHP scripts into your HTML page, you can stay with HTML (btw, your php files can have .htm or .html extension, you just need to add a line to .htaccess file; as a result the server will parse HTML files just like normal PHP files). It's even possible to use PHP and SSI (.shtml) together, like I do on qesign.com (although, I would not recommend it as there're some limitations and "side effects"). If you have enough skills, build a PHP site.
I don't really have any php coding skills, I was just going to creat normal html site in dreamweaver and then save the pages as .php
forcing the server to parse html pages as php via .htacces is easier than rename your files. Make php pages with no php coding serves to make people believe your page is dynamic when it is not, but from the server perspective, you are wasting resouces that way. For future development, using php extension or htaccess to parse simple html pages enable you to integrate php snippets or basic coding without having to do the changes then