Forum Moderators: phranque
In general, mod_rewrite code placed in httpd.conf executes much faster than similar code placed in .htaccess. The reason for this is that mod_rewrite code in httpd.conf is compiled as the server is restarted, whereas code in .htaccess must be interpreted for each and every HTTP request that accesses resources in the directory in which that code resides. So, it is usually much more efficient to place the code in httpd.conf. On the other hand, each time you make a change to your code in httpd.conf, you must restart your server to recompile the code. So, some people develop in .htacccess and deploy to httpd.conf only after extensive testing.
Be aware also that there are subtle differences in the two contexts. In particular, if your .htaccess code is written without a RewriteBase directive, you will have rules that look like this example:
RewriteRule ^somefile\.ext$ /someotherfile.ext [L]
RewriteRule [b]^/s[/b]omefile\.ext$ /someotherfile.ext [L]
If you intend to use your code on multiple servers, where some will have mod_rewrite installed and others won't, then you will want to place your code within an IfModule container. Otherwise, where you place it depends on whether it applies only to a single server, or to a single virtual server, versus applying to multiple virtual servers. So, you'll need to ask yourself whether the rules apply to one or more servers on your machine, and place the code in the appropriate container.
Jim