Forum Moderators: coopster
AddType application/x-httpd-php .html .htm .php
Does anyone have any experience with this, if so does it work or are there some pitfalls. I was going to produce a static html site from our database but use the php in the background for functionality; but if this avoids the need to do that it maybe useful (i think!). Any advice would be much appreciated. TIA. Stuart.
Whether this has any effect on the way search engines treat the page I don't know - I've not seen any yet.
Generally I produce static pages as you were considering, just to be on the safe side - would it be a major task to do that on your site?
I know its a never ending question but whilst i'm here and because we're so new too this can i ask if you have any general tips or know any major pitfalls to this sort of set up?
We currently produce static pages offline using templates and a java pagebuilder, but whats the best set up if we have a mysql database online (sychronised in parts offline).
How longs a piece of string, right!?!
Hehe, that's about right ;)
Much depends on the design of your site. In my case I build the site in Perl or PHP, using modules / includes to provide the templates.
Rather than using a single dynamic 'display' page that pulls data from a database (eg display.php?product=1), I use individual files that act as a wrapper for the display routines - eg file product1.php would simply consist of:
<?
$product=1;
include("display.php");
?>
All internal navigation points to these wrapper pages rather than the actual pages that generate the dynamic content, so there's a fully spiderable site structure there that doesn't rely on query strings. Whether this structure is the main navigation of the site or done through building a site map is up to you.
At this point you could use the AddType 'trick' to name the pages as .html, but I use a Perl script to spider the site and save the spidered pages as static html, adjusting the internal links from .php to .html, which effectively generates a static 'mirror' of the site. Once functionality is required (eg 'add to cart'), the original PHP pages take over.
All this is done on the development server, and I then transfer the whole lot to the production server.
I'm sure there are many other approaches but I've found this one to be the most effective for me.
I didn't realize the header info, thanks sugarkane, the thought actually never crossed my mind.
as far as i know search engines dont care about the php in a pages, and there are many more widely used methods of finding if a page was dynamically created. This goes back to the http specification, if you are interested in knowing I will go on.
If you are going to be using php in all your pages any ways, the only problem I can see with the .html is deleting or causing an error in your .htaccess file could cause a lot of damage, including revealing the pass and username for your database. I know the odds are slim if you are using a production server but it could happen. There are ways around this if you would like to hear about it.
I don’t want to keep you too long,
Brendan