Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 aware that if you set the svn:mime-type Subversion property on a .html file to text/html then when viewing the file in a browser through the Subversion module in Apache httpd it will be served with a Content-Type: text/html header, enabling the browser to render it as HTML rather than plain text.

However, I am looking for a way to do this without using the svn:mime-type property.

I'm aware that you can configure your svn client to automatically add the property - this is not what I want, as I do not want to ensure all users have these settings. I'm also aware that I could create a pre-commit hook that rejects the commit if the properties are not set, in order to force users to set the property - I might fall back to that, but I'm looking for something less intrusive.

I'm also aware that I could use a post-commit hook to add the properties automatically on the server-side. I'd rather not do that (as users then have to update immediately after their commit, and it's not trivial to write) - I'm looking for a better alternative. Perhaps something with rewrite rules in the Apache server?

share|improve this question

Short answer - yes - set ModMimeUsePathInfo to on to make Apache responsible for the MIME types.

Longer answer - yes but you need to be using a relatively modern version of Subversion within your Apache server.

Normally the content is being served by the mod_dav_svn module which is interrogating the Subversion repository, therefore the mime-type would be specified by the Subversion module.

Historically this was only able to be configured using the svn:mime-type property. See this thread on the Subversion User's mailing list for an example of someone attempting to perform something similar.

Now, using the ModMimeUsePathInfo directive will tell Apache to figure out what MIME type to specify using mod_mime - see Appendix C, WebDAV and Autoversioning of the Subversion book for more info.

Specifically something like:

<Location /repos>
    DAV svn
    SVNPath /var/svn/repository
    SVNAutoversioning on

    ModMimeUsePathInfo on
share|improve this answer

Apache's mod_mime will determine the content type if no svn:mime-type property is set. Enable it in the Apache configuration:

LoadModule mime_module modules/

The MIME type of files with extension .html is text/html in the default configuration. Tested with Apache 2.4.10 and Subversion 1.8.11.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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