On Mon, Oct 3, 2011 at 2:25 PM, Nick Tkach <ntkach@gmail.com> wrote:
Does anyone have any pointers/suggestions on the best way to do vanity url rewrites?

For example,


Being sent to


Drupal uses rules like this:

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !=/favicon.ico
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

That is, "if there is no matching file or directory, redirect to an index.php script and pass the URL in as the parameter q".  That script then looks up the URL in a database and serves up the right content.

That is a pretty common approach.

Hope this helps,