Re: [users@httpd] Vanity URL Rewrites Best Practices?

2011-10-03 Thread Scott Gifford
On Mon, Oct 3, 2011 at 2:25 PM, Nick Tkach  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  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.


[users@httpd] Vanity URL Rewrites Best Practices?

2011-10-03 Thread Nick Tkach
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


We've got a very frequent process where we'll get a huge block of rewrites
like this that vary just by the last part and so far just keep going through
and adding dozens and dozens of new rewrite rules each time.  Surely there
has to be a better way?  (Ideally that just involve Apache changes and not
code changes on the back-end)