Part of the capability of this wonderful module is to translate requests for web pages using regular expressions, and before you mutter "incomprehensible geek rubbish, tuh", let me give you an example:

Let’s say you have a simple product database online, that people access through the following URL:

www.yourwebsite.com/products/

People can see your list of products and click the link to view the full details, which would take them to a page such as this:

www.yourwebsite.com/products/product.php?id=1234

You’ll see the id=1234 bit at the end of that link, it tells the product.php page to show the details for the product with the ID number 1234. Simple, the page goes to the database, fetches the details, and puts them on the screen.

However, and if you’ve used this technology before please bear with me, it would be much nicer to have a clean URL – one without those question marks, equals signs and ID business, wouldn’t it? Perhaps something like:

www.yourwebsite.com/products/1234/

Well, with mod_rewrite this is entirely possible! I won’t go into details here as you can read all about it in the mod_rewrite documentation. However, the problem is knowing when your web server supports it.

So I wrote this little test, to see whether mod_rewrite, and in particular the bit that does the URL translation, RewriteEngine, is functional. Download the test files in ZIP format here. It’s a very simple test, setting up a single re-written URL, then seeing if that URL responds. If it does then the clean url thingy works, if not, then it doesn’t. Just unzip the files, place in any directory of your website and navigate to the check.php file.

I’m currently working on a function to automatically swap between "clean" and "dirty" URLs, depending on the support available. Of course, you can always ‘roll-your-own’ if you want. Let me know if this is useful to you.