httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Gifford <sgiff...@suspectclass.com>
Subject Re: [users@httpd] Vanity URL Rewrites Best Practices?
Date Tue, 04 Oct 2011 03:01:06 GMT
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,
>
>
>
> 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.

Mime
View raw message