On Mon, Oct 3, 2011 at 2:25 PM, Nick Tkach <ntk...@gmail.com> wrote:

> Does anyone have any pointers/suggestions on the best way to do vanity url
> rewrites?
>
> For example,
>
>
>
> http://foo.com/mmh/maintenance_plan/tip?contentCategoryType=MaintenanceTip&id=%2Fwww%2Favm_webapps%2Fmmh%2Fmaintenance-tips%2Fcontent%2Fafter_blizzard.xml
>
>
> Being sent to
>
>
>  http://foo.com/mmh/articles/authored/after-blizzard


Drupal <http://drupal.org/> 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,

-----Scott.

Reply via email to