Web Development Tutorials for February 2011

HTML Redirect

To perform a HTML redirect we need to make use of the meta refresh tag. This is a particular meta tag which is used to tell the browser to go to another location. Redirecting a browser using the meta refresh method is discouraged since an unexpected redirection may disorient users.

In some cases, redirecting a web page using the meta refresh is required. The method is suitable for periodically refreshing a dynamic page to get new news or status updates for example, and is used when Javascript methods of redirection are unwanted.

Ignore IP Address Awstats

In this tutorial, we will learn how to ignore or exclude specific IP addresses from our Awstats data. When set up, Awstats parses our server log files and generates detailed reports of user locations, IP addresses, referrers, and so on. Awstats can be used to give an excellent idea of where your visitors are coming from, how they got to your site, and what they are looking on once on your site.

Using this information will allow a webmaster to fine-tune aspects of his or her site for maximum user satisfaction.

How many pages should my website have?

Time and again we hear that "content is king" and that statement is very true. With that in mind, the question of how many pages a website should have often pops up. If content really is king then ideally a website should have infinite pages. That is for the perfect world, but in the real world you can get away with much less.

Change DNS Server in Ubuntu from the Command Line

Changing the existing Domain Name Server IP address or configuring DNS name resolution under Ubuntu Linux is fairly simple with the command line. All you need to do is edit the /etc/resolv.conf file. You may want to change your nameserver for a number of reasons. Suppose your existing nameserver is slow or is not updating properly; you can specify a new nameserver to get rid of all those problems.

Simply use your favourite text editor to edit the file /etc/resolv.conf as the superuser.

To use nano text editor:

Using wget and an XML Sitemap to Spider website - Keeping the Drupal cache warm

This tutorial will speak in the context of using this technique on a website which uses Drupal for content management. This technique need not be limited to a Drupal website and should work well if adapted properly.

Htaccess 301 Redirect

Redirecting a web page from one URL to another is best achieved using a HTTP redirect. You may want to perform a redirect after changing the URL of a page and you want existing links to the old URL to remain valid. In this tutorial, we look at how to do an htaccess 301 redirect.

Update Ubuntu using the Command line

Updating your Ubuntu Linux distribution using the command line is very simple two-step process. Using the package manager, you can easily update your system as it automatically finds newer versions of your installed software. To perform the update, you will need to:

  • Refresh the apt system to ensure it contains all the newest information about packages
  • Download then install any packages that have newer versions

Pretty simple isn't it? The details of updating are below.

Protect cron.php in Drupal 6

By default, anyone can run cron.php on a Drupal 6 installation. That means everyone with access to your website can run your cron.php file. Since cron.php is used for maintenance it would make sense that it is prevented from being run arbitrarily; whether or not an outsider running it can cause damage is merely a side issue.

Difference between Truncate and Delete in SQL

We saw how to delete some records from our database in our MySQL Delete Query tutorial. We also saw how to use the TRUNCATE command in our MySQL Truncate tutorial. Both commands have the potential to delete all the records in a table but there are a few differences.

The DELETE command can:

  • delete a single record
  • delete more than one records (based on conditions)
  • delete all records from a table

What is Page RPM?

Page RPM is literally means Page Revenue Per Thousand impressions. The letter "M" in the abbreviation is the Roman numeral which means one thousand. Page RPM is basically a calculation which shows the average projected revenue of a page per thousand impressions that it gets.

Page RPM is a useful figure for comparing the performance of different webpages. By scaling the earnings of a page to what would happen if the page got a thousand impressions, we would be able to compare pages independent of the number of impressions that each particular page got.

MySQL Delete Table

There is no outright DELETE TABLE command in MySQL. The DELETE command is limited to deleting rows in a table but not the table itself. If we want to delete a table in MySQL we use the DROP TABLE command. We looked at deleting a table in our MySQL Drop tutorial but here is a short refresher tutorial.

If we have a table called "employees" for example, and we want to delete it, we would use the following SQL:

DROP TABLE employees;