Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Apache as the HTTP server in order for me to access the Subversion repository, since I don't find any .htaccess file as I am not tied the svn directory to /var/www, can I put the RewriteCond and RewriteRule in httpd.conf?

share|improve this question

marked as duplicate by Jenny D, Stephane, Dave M, Lucas Kauffman, mdpc Jun 25 '13 at 16:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Yes. See… for more information. – Jenny D Jun 25 '13 at 7:40
up vote 2 down vote accepted

If you read the documentation, you will notice that every Apache directive comes with a fairly standard block of information

RewriteCond Directive

Description:  Defines a condition under which rewriting will take place
Syntax:       RewriteCond TestString CondPattern
Context:      server config, virtual host, directory, .htaccess
Override:     FileInfo
Status:       Extension
Module:       mod_rewrite

Note the Context:

This tells you where a particular directive may be used.

share|improve this answer
@lain Thank you so much on your guidance, I have overlook the doc. – huahsin68 Jun 25 '13 at 8:42

Putting these in httpd.conf (in your virtual host section for the repositories) is certainly possible. Additionally, if you are including the virtual host by reference to another configuration file, you should put the mod_rewrite directives in there.

I actually find it preferable to do this; .htaccess files should be disabled whenever possible. This is particularly true on sites to which users can upload content, to minimize security exposure and keep configuration completely out of band. It also has performance implications -- the .htaccess file is reread every time a URL to which it might apply is accessed, because it can change without a configuration reload, whereas the actual server configuration is only reevaluated when rehashing or starting apache.

share|improve this answer
Using .htaccess files may also cause a reduction in performance, since the server will re-read the .htaccess file on every access. The main config file will only be re-read when the server is started or a reload command is issued. – Jenny D Jun 25 '13 at 7:56
Good point; I never thought of that. I'll edit it in. – Falcon Momot Jun 25 '13 at 7:57
Most sites won't notice the difference, but I've been in places where it's been very noticeable. – Jenny D Jun 25 '13 at 8:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.