Taking tutorial submissions! Please email them to dave[AT]icemelon[DOT]com for review. Thanks!

Latest Tutorials
IceMelon IM: Add IM Functionality to phpBB [Misc] Want to add site-wide member IM to your phpBB community? Sure you do. Simple step-by-step instructions inside.

IceMelon IM: Add IM Functionality to vBulletin [Misc] Want to add site-wide member IM to your vBulletin community? Simple step-by-step instructions inside.

Crawl Your Site for PageRanks [PHP] So you know your site has a PageRank of 8. What about the PRs of all the inner pages? This tutorial will teach how you to automate the process of grabbing all these PRs.

Create CAPTCHA images [PHP] Worried about bots? Then create CAPTCHA images to prevent bots from taking advantage of your site.

Convert SHN and FLAC files to MP3 [Misc] Low on disk space and have an insensitive ear? Here are some steps to converting SHN and FLAC files to MP3 format.

[View All]

Become a sponsor for $15/month. Link is sitewide - PR5 homepage, 20+ PR4 pages, 90+ PR3 pages. Email dave[AT]icemelon[D0T]c0m.

Awesome Tutorials

Generate HTML Files
By dave

If you're confused by this tutorial's description, let me illustrate by example.
original URL
[http://www.icemelon.com/tutorials.php?id=1®ular+expressions]
new URL
[http://www.icemelon.com/tutorials/1/regular_expressions.htm]

If you click both links, you'll realize that they actually point to the same webpage. How is this possible?

mod_rewrite
The magic lies in mod_rewrite. You need to make sure this is available on your server. To do that, I would just test out this tutorial. See if you can get it working.

The mod_rewrite module enables you to direct nonexistent pages to existing ones. Code for it goes into the .htaccess file. Here is what I had in the .htaccess I stored at www.icemelon.com/tutorials/:
RewriteEngine On
RewriteRule ^([0-9]+)/.*$ http://www.icemelon.com/tutorials.php?id=$1

Breakdown
The first line turns this feature on. The second line does the magic. It's essentially comprised of 3 parts (each part separated by a space):
1) RewriteRule
2) <expression>
This is just a regular expression. The [0-9] stuff means any numeric character. (Alternatives for that include [a-z] and [A-Z]. If you're expecting an alphanumeric character, then use [0-9a-zA-Z].) Stuff you put in parentheses are values you wanna store. In the code above, we're only keeping one a value, a number. This is automatically stored in the variable '$1.' If we were to store more values, they would go into '$2,' '$3,' etc. (This is done automatically.) The first set of parentheses corresponds to '$1,' the second, '$2,' and so forth. For more on regular expressions, check out the tutorial linked to above.
3) <URL to redirect to>
This is the actual webpage (the PHP script). In code above, '$1' is used, which happens to be the tutorial's ID number. Realize that the tutorial's title isn't even needed.

some PHP
Here's how the tutorial HTML link was generated. It's easy to figure out yourself, but I'll include it anyway. First, let's assume '$id' stored the tutorial's id and '$title' stores its title.
$link = "http://www.icemelon.com/tutorials/$tutorialID/" .str_replace('+', '_', urlencode($title)) .'.htm';
PHP:Urlencode makes sure that all the characters are valid URL characters. For our purposes, I don't think this is really necessary, but it's a good habit. This function will also convert spaces to +'s. Thus, PHP:str_replace will change those +'s to underscores. Then, just append a ".htm."

A lot of sites use the trick described in this tutorial. Icemelon, included. The primary reason is so that search engines will index all of the site's pages. In other words, google will definitely index whatever/however/whenever.php, but not necessarily index whatever.php?question1=however&question2=whenever.

Also, it looks nicer.

P.S. Check out my new site TheManWhoSoldtheWeb.com, where I publish guides and scripts on Internet Marketing and SEO. Here is a limited time freebie: the Rapid Google Indexer.


» Bookmark this Tutorial
» Bookmark IceMelon
Icemelon -- Generate HTML Files -- PHP, CSS, Javascript Tutorials, & More!
  © 2005-2010 Icemelon.com   Email: dave[AT]icemelon[D0T]c0m