views:

232

answers:

2

I just want to browse my Subversion code repositories and view files. Some of the file types, like .VBS, prompt me to open or save the file, but I just want to view it in the browser as plain text. Can Apache's httpd.conf file be modified to do this? I don't think it would be changed on the client (IE7) because then it would work the same on all sites.

+1  A: 

Put the following into your httpd.conf

<IfModule mime_module>
AddType text/plain .vbs
</IfModule>
Jordan S. Jones
Do I add additional types with spaces or comma separation? Like AddType text/plain .vbs ps1 css
Bratch
Spaces. The documentation on the topic, for Apache 2.2: http://httpd.apache.org/docs/2.2/mod/mod_mime.html#addtype
Jordan S. Jones
+2  A: 

You can set the mime type of all your vbs files to text/plain by doing this in the root of your working copy:

svn propset --recursive svn:mime-type text/plain *.vbs

and then commit the changes. Explanation from the svn book on repository browsing:

To make this happen, you need only to make sure that your files have the proper svn:mime-type set. We discuss this in more detail in the section called “File Content Type”, and you can even configure your client to automatically attach proper svn:mime-type properties to files entering the repository for the first time; see the section called “Automatic Property Setting”.

So in our example, if one were to set the svn:mime-type property to text/html on file foo.html, Apache would properly tell your web browser to render the file as HTML. One could also attach proper image/* MIME-type properties to image files and ultimately get an entire web site to be viewable directly from a repository!

Wim Coenen
Thanks, I'll be trying this Monday. It seems better to do it through SVN than the Apache conf, although both would work. I tried to search for how to do this, but couldn't get good key words to nail down an answer. Looks like I need to go straight to the documentation.
Bratch