I have just completed this tutorial (and afew others) on how to use mod_rewrite with apache: http://www.workingwith.me.uk/articles/scripting/mod_rewrite . However, they all focus on using the .htaccess file to rewrite URLs
How can you use this rewrite engine module from the apache.conf / httpd.conf files or just from within the '/etc/apache2/sites-enabled' directory itself... ? Examples of any additional syntax needed on how to do this would be useful.
I have root access to my system so I would prefer to avoid using .htaccess files if at all possible. My system is Ubuntu-Server 10.04
Syntax is the same, but you have to make sure that you put your rules in the correct location within the httpd.conf file (or vhosts.conf or whatever is appropriate for your distro) depending on your requirements.
So if your rewrite rule is specific to a particular Virtual Host, then the rewrite rule would go in the container for that Virtual Host. If the rule is global (e.g. affects all sites), then you can put it anywhere in the httpd.conf file.
Documentation on mod_rewrite and context should be useful references for this. An Apache book is worth investing in if you will be doing a lot of this!
Out of interest, why do you want to avoid using .htaccess files for this? Changes in the .htaccess files are immediate, whereas changes in httpd.conf etc require apache restart to be effective.
I know it's a snotty answer - but it really is the right one - RTFM! (to any prudes out there, the F stand for 'fine', if you read something else it's because YOU have a potty-mouth, not me)
The Apache documentation clearly says where (i.e. in what contexts) directives can be used. If in doubt, it's always there in black and white for every single directive you can use. If you're going to be admining Apache, you simply cannot avoid learning to read Apache documentation.
In this case, it says that you can use RewriteRule in "server config, virtual host, directory, .htaccess". (http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule)
To answer your other question, no, the syntax does not change. In reality the chances are you are using named virtual hosts, so the logical place for your rewrite rules is inside the relevant VirtualHost directive.
Bart.