Knightnet Site Design - Static vs Dynamic Web Pages

You are in section: Home > Site Design

What do I mean by Static and Dynamic?

A static web page is one where the content is written like an ordinary document and does not tend to change.

A dynamic web page is one where the content changes rapidly. It is typically provided via a scripting feature such as Microsoft's ASP, Coldfusion or, as on this site, PHP. These "server side" scripts control the selection and presentation of the information and deliver a page "dynamically", that page may be unique every time it is requested.

Just to confuse matters, dynamic web pages may contain simple, static contents as indeed most of this site does. In this case, the dynamic features are used for the convenience of the web site maintainers and content providers.

Dynamic content may often, however, be provided from a database source. On this site, a number of sections are fully dynamic with information provided from a database (the open source mySQL relational database in fact). You can see an example of this in the Knightnet site To Do list.

You can often see whether a web site has delived a page dynamically by looking at the file extension in the URL. Dynamic pages tend to have extensions such as .asp or .php whereas static pages tend to use .htm or .html. However, this is not a totally reliable guide, see below for the reason.

An even better indication is where the URL is very long, especially when it contains a query string as in:

http://www.mywebsite.com/mywebpage.php?id=012&other=something

Everything after the "?" is the query string and is passed to the specified page as a set of variables.

The advantages and disadvantages of using Static Web Pages?

Static web pages are simply files in a filing system and so are very easily created and managed using standard operating system filing tools and a text editor, no special tools are really needed even when the files are on a remote server.

Web servers are specifically designed to get data from a file to the network in a very fast and efficient manner. This has the lowest overheads so supports the highest level of throughput.

Web index "robots" such as those used by Google, AltaVista and so on will generally only index static content as they believe (often wrongly, though they have no way of knowing) that dynamically driven content. will change too rapidly to be sensibly indexed. So a static web site is easily indexed and so searchable across the web.
JK Jan 2003: Note that this is no longer the case, all of the major search engines now support dynamic web pages.

Web site maintainers and content providers must create each web page from scratch and must manually maintain the structure of the site. This can be helped by using a tool such as Microsoft's Frontpage or one of many similar tools but these tend to be expensive for just creating personal web sites. They can also be complex to learn and use.

The advantages and disadvantages of using Dynamic Web Pages?

Dynamic pages can be "templated". That is to say, the web site maintainer can create a single (or a few) template/s which control all of the structure and visual design of the site. Content providers can then provide simple content without having the worry of maintaining the correct structure. This is a massive advantage even for a relatively simple site such as this one.

As indicated in the previous section, web indexing robots will generally not index dynamic pages or will do so only in a very limited way.
JK Jan 2003: Note that this is no longer the case, all of the major search engines now support dynamic web pages.

Not only do dynamic pages make external indexing harder but, inevitably, it also makes local indexing and searching harder. See below for a possible solution.

Which Scripting Engine Should I use?

As stated earlier, the main contenders are Microsoft ASP, Colfusion and PHP.

Microsoft ASP

This is Microsoft's web server scripting language and is really only fully supported under Microsoft's web server, IIS. To my mind, this makes it a limited option and I never really recommend the use of IIS, mainly for security reasons.

Coldfusion

I've really not used this in anger so can't comment that much. However, it is a commercial product so is only suitable for commercial projects.

Additionally, it does not seem to be well supported amongst the web hosting providers which further limits its use.

PHP

This is probably far-and-away the most popular web scripting language.

It is commonly available on web hosting packages, even very low cost ones, and is also fully supported on several platforms including Linux and Windows.

PHP is also free of charge which makes it attractive for a very wide range of projects. Despite being open source, it is well supported, in active development and easily robust enough for large scale web projects.

Other

Though these are the main contenders, many other options are available such as: PERL, PYTHON, ZOPE, Java, ...

Many of these are useful for complex web programming but cannot easily compete with the ease and speed of development of the more focused languages.

Conclusions

Although dynamic pages make indexing more complex at least part of that issue can eaily be overcome using the process outlined below. They do however, provide very large gains in terms of site maintenance and so are well worth using.

Furthermore, all of these features can be obtained, even in a multi-platform environment, using free tools. The LAMP (Linux, Apache, mySQL, PHP) or WAMP (Windows, Apache, mySQL, PHP) web development environments are now so popular that they have generated their own acronyms. This combination of tools, though largely or completely free are easily able to seve large scale, complex web developments.

How to get the best of both worlds?

Actually, it is not difficult to get the best of both worlds. On this site I use one simple strategy but there are others if your needs are more complex.

What I have done is to reassign the ".htm" file extension as being delivered dyamically (equal to a file with a ".php" extension. So the main files appear externally to be static but in fact are dynamic. This means that I can still use genuinely static files if I want to by naming them with a .html extension.

One thing you do need to know however is that this method only helps with being indexed by the web search engines. It does not help with local site searches very much, for that you still need an indexing process.

I have yet to set this up for my site but one way would be to capture a static version of the site by using a tool to grab the pages from the web and then to index that copy using standard tools. An easier alternative is to use the META tag "keywords" to provide search hints for each page. It is easy to pick this data out of the pages and create a searchable index.

.htaccess Overrides

This only really applies to the Apache web server though I believe some other servers provide the same or similar facilities. Apache, though, is the most popular web server especially amongst ISP's. See my Site Security page for more details on this.

Most sites have access, then, to a facility called ".htaccess" files. These files allow you to specify overrides for the web server configuration and it is this facility that I use.

Here is the relavent part of the .htaccess file on this site:

# Add .htm files to php processed list to fool search engines # use .php & .htm for php processed, .html for static AddType application/x-httpd-php .php .htm # Ensures that requests for index.html files are redirected to .htm RewriteEngine on RewriteBase / RewriteRule ^index\.html$ index.htm [T=application/x-httpd-php]

This file lives in the filing system folder that is the "root" of my web site and so the settings are inherited by all of the folders and files that make up the web site.

The second part of the override is a nice to have rather than being essential and you should note that it requires your web site to support "mod_rewrite" under Apache and local overrides must have been allowed.

To see more about the features of .htaccess files, see the page on Site Security.

Most paid web service providers should allow mod_rewrite as mine does. If yours doesn't, it is not a major issue but you could always try a different ISP such as the one I use, UK Web Solutions Direct www.ukwebsolutionsdirect.net. I can certainly recommend them, especially at UKP20-40 per year!

What do I mean by Static and Dynamic?

A static web page is one where the content is written like an ordinary document and does not tend to change.

A dynamic web page is one where the content changes rapidly. It is typically provided via a scripting feature such as Microsoft's ASP, Coldfusion or, as on this site, PHP. These "server side" scripts control the selection and presentation of the information and deliver a page "dynamically", that page may be unique every time it is requested.

Just to confuse matters, dynamic web pages may contain simple, static contents as indeed most of this site does. In this case, the dynamic features are used for the convenience of the web site maintainers and content providers.

Dynamic content may often, however, be provided from a database source. On this site, a number of sections are fully dynamic with information provided from a database (the open source mySQL relational database in fact). You can see an example of this in the Knightnet site To Do list.

You can often see whether a web site has delived a page dynamically by looking at the file extension in the URL. Dynamic pages tend to have extensions such as .asp or .php whereas static pages tend to use .htm or .html. However, this is not a totally reliable guide, see below for the reason.

An even better indication is where the URL is very long, especially when it contains a query string as in:

http://www.mywebsite.com/mywebpage.php?id=012&other=something

Everything after the "?" is the query string and is passed to the specified page as a set of variables.

The advantages and disadvantages of using Static Web Pages?

Static web pages are simply files in a filing system and so are very easily created and managed using standard operating system filing tools and a text editor, no special tools are really needed even when the files are on a remote server.

Web servers are specifically designed to get data from a file to the network in a very fast and efficient manner. This has the lowest overheads so supports the highest level of throughput.

Web index "robots" such as those used by Google, AltaVista and so on will generally only index static content as they believe (often wrongly, though they have no way of knowing) that dynamically driven content. will change too rapidly to be sensibly indexed. So a static web site is easily indexed and so searchable across the web.
JK Jan 2003: Note that this is no longer the case, all of the major search engines now support dynamic web pages.

Web site maintainers and content providers must create each web page from scratch and must manually maintain the structure of the site. This can be helped by using a tool such as Microsoft's Frontpage or one of many similar tools but these tend to be expensive for just creating personal web sites. They can also be complex to learn and use.

The advantages and disadvantages of using Dynamic Web Pages?

Dynamic pages can be "templated". That is to say, the web site maintainer can create a single (or a few) template/s which control all of the structure and visual design of the site. Content providers can then provide simple content without having the worry of maintaining the correct structure. This is a massive advantage even for a relatively simple site such as this one.

As indicated in the previous section, web indexing robots will generally not index dynamic pages or will do so only in a very limited way.
JK Jan 2003: Note that this is no longer the case, all of the major search engines now support dynamic web pages.

Not only do dynamic pages make external indexing harder but, inevitably, it also makes local indexing and searching harder. See below for a possible solution.

Which Scripting Engine Should I use?

As stated earlier, the main contenders are Microsoft ASP, Colfusion and PHP.

Microsoft ASP

This is Microsoft's web server scripting language and is really only fully supported under Microsoft's web server, IIS. To my mind, this makes it a limited option and I never really recommend the use of IIS, mainly for security reasons.

Coldfusion

I've really not used this in anger so can't comment that much. However, it is a commercial product so is only suitable for commercial projects.

Additionally, it does not seem to be well supported amongst the web hosting providers which further limits its use.

PHP

This is probably far-and-away the most popular web scripting language.

It is commonly available on web hosting packages, even very low cost ones, and is also fully supported on several platforms including Linux and Windows.

PHP is also free of charge which makes it attractive for a very wide range of projects. Despite being open source, it is well supported, in active development and easily robust enough for large scale web projects.

Other

Though these are the main contenders, many other options are available such as: PERL, PYTHON, ZOPE, Java, ...

Many of these are useful for complex web programming but cannot easily compete with the ease and speed of development of the more focused languages.

Conclusions

Although dynamic pages make indexing more complex at least part of that issue can eaily be overcome using the process outlined below. They do however, provide very large gains in terms of site maintenance and so are well worth using.

Furthermore, all of these features can be obtained, even in a multi-platform environment, using free tools. The LAMP (Linux, Apache, mySQL, PHP) or WAMP (Windows, Apache, mySQL, PHP) web development environments are now so popular that they have generated their own acronyms. This combination of tools, though largely or completely free are easily able to seve large scale, complex web developments.

 

How to get the best of both worlds?

Actually, it is not difficult to get the best of both worlds. On this site I use one simple strategy but there are others if your needs are more complex.

What I have done is to reassign the ".htm" file extension as being delivered dyamically (equal to a file with a ".php" extension. So the main files appear externally to be static but in fact are dynamic. This means that I can still use genuinely static files if I want to by naming them with a .html extension.

One thing you do need to know however is that this method only helps with being indexed by the web search engines. It does not help with local site searches very much, for that you still need an indexing process.

I have yet to set this up for my site but one way would be to capture a static version of the site by using a tool to grab the pages from the web and then to index that copy using standard tools. An easier alternative is to use the META tag "keywords" to provide search hints for each page. It is easy to pick this data out of the pages and create a searchable index.

.htaccess Overrides

This only really applies to the Apache web server though I believe some other servers provide the same or similar facilities. Apache, though, is the most popular web server especially amongst ISP's. See my Site Security page for more details on this.

Most sites have access, then, to a facility called ".htaccess" files. These files allow you to specify overrides for the web server configuration and it is this facility that I use.

Here is the relavent part of the .htaccess file on this site:

# Add .htm files to php processed list to fool search engines # use .php & .htm for php processed, .html for static AddType application/x-httpd-php .php .htm # Ensures that requests for index.html files are redirected to .htm RewriteEngine on RewriteBase / RewriteRule ^index\.html$ index.htm [T=application/x-httpd-php]

This file lives in the filing system folder that is the "root" of my web site and so the settings are inherited by all of the folders and files that make up the web site.

The second part of the override is a nice to have rather than being essential and you should note that it requires your web site to support "mod_rewrite" under Apache and local overrides must have been allowed.

To see more about the features of .htaccess files, see the page on Site Security.

Most paid web service providers should allow mod_rewrite as mine does. If yours doesn't, it is not a major issue but you could always try a different ISP such as the one I use, UK Web.Solutions Direct Hosted by UK Web.Solutions Direct . I can certainly recommend them, especially at UKP20-40 per year!

 

Sections:

Pages:

Valid HTML 4.01 iconValid CSS icon
© Copyright Julian Knight, July 2008 All rights reserved.
Page: Updated 2008-07-10 08:50:07, Author Julian Knight