Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 serverfault.com/questions/214512/… for more information. –  Jenny D Jun 25 '13 at 7:40
add comment

2 Answers

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
add comment

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
1  
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
add comment

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