How do I use .htaccess to trigger mod_rewrites before D7's Clean URLs take over? I am migrating from olddjango.com to newdrupal.com, and need a way to alter the URLs from the old style into the a format we've chosen for the new Drupal application.

In addition to rewriting them, I want the final "corrective" rule to redirect, to register the 301.  The structure of the URL has a marker that I'm using as a RewriteCond, it is the last thing I change before the redirect (so the URI won't get rewritten unless it is from the old site).

I've written a small number of mod rewrite rules, which work well enough in http://htaccess.madewithlove.be/

If I put them in my /etc/httpd/conf/httpd.conf they work smashingly... but that isn't a viable option. (it theoretically COULD be... but only as a last resort)

However, when I put them in /.htaccess, they do absolutely nothing...

I put them at the top of the file, before anything else, I put them at the bottom... and in the middle.  I tried with and without "RewriteBase /"... 

I'm obviously missing something, or the nature of D7 disallows pre-empting the machinations of Clean URL.  I've found at least one person saying it was possible, but no one saying there were any special tricks involved, or actual documentation... so I'm just trying to get an answer committed to the interwebs one way or the other.

This is the final rule of my section of rewrites:

RewriteCond %{REQUEST_URI} ^/?gbnk/?.* [NC]
  RewriteRule ^/?gbnk/?(.*) $1 [NC,R=301,L]
Personally, I would see if the Redirect module works for your needs.  Is it basically a UI interface for making 301 redirects.  Off the top of my head, though, I don't recall if it will work with patterns.

If that doesn't work, then your best bet is to put them in the .htaccess right after the 

# RewriteBase /


line.

Just remember that mod_rewrite will continue to process rules unless you use the L flag.  You also want to explicitly give the response code with the R flag.  Something like this should work

# RewriteBase /

RewriteRule ^some/path/(.*) /other/place/$1 [R=301,L]
RewriteRule ^another/hierarchy/(.*) /different/thing/$1 [R=301,L]

# Pass all requests not referring directly to files in the filesystem to
# index.php. Clean URLs are handled in drupal_environment_initialize().
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]


Keep in mind that rewrites can be frustratingly hard to debug, but logging can help.  Also make sure you are using rewrites and not redirects.  Mixing mod_rewrite and mod_alias in same .htaccess will cause all sorts of grief because of process order.