.htaccess rewrite rule for sexier URL query strings

A simple rewrite rule affords a far more attractive site URL structure. Instead of having URLs like this:

http://example.com/index.php/zone/
http://example.com/index.php/zone/param/param

You can use URLs that look like this:

http://example.com/zone/
http://example.com/zone/param/param

To enable URL rewriting, add the following snippet to your existing .htaccess file, or save it as a new file called .htaccess in the root of your project.

# .htaccess file for Zoop applications
# Applies rewrite rules for canonical domain names and sexier URI query strings.
 
<IfModule mod_rewrite.c>
  RewriteEngine on
 
  # Canonical domain name rewrite
  # Modify the next two lines to redirect to a canonical domain name.
  #RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
  #RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
 
  # Modify the RewriteBase if you are using Zoop in a
  # subdirectory and rewrite rules don't work.
  RewriteBase /
 
  # Rewrite URLs to the form 'index.php/x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>

Note: This is a quick and dirty rewrite rule snippet, and I'm sure you could come up with a use case that will break it. I mostly use it on Linux/BSD with Apache. It may or may not work with lighttpd, IIS (with mod_rewrite support), etc. Let me know if you're struggling with it on another system, or if you find a way to break it, and I'll see what I can do to help.