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.

when opening an subversion URL like https://server.local/svn/reproname using a normal webbrowser I get a (not very nice but useful) webpage showing me the files of the highest revision of the repository.

Is it possible to change this HTML-view to use WebSVN instead? So I want to use the same URL for TortoiseSVN which then browses the repository using WebDAV and for browsing it with a webbrowser getting the nice interface of WebSVN.

I am using Apache 2.2 on an Win 2003 Server with mod_dav_svn.

Thanks in advance for any help.

sc911

share|improve this question

3 Answers 3

up vote 2 down vote accepted

What about using mod_rewrite? You could do something like this:-

RewriteCond %{HTTP_USER_AGENT}          !^SVN.*
RewriteRule ^/svn/(.*?)(/.*)$           http://websvn.host/websvn/listing.php?repname=$1&path=$2      [R]

This should redirect any client that doesn't have a User-Agent string starting with 'SVN/' to a WebSVN installation at http://websvn.host/websvn/, and leave queries from SVN clients alone.

share|improve this answer
    
Interesting but it could break some third party svn clients –  Alexandre Jasmin Feb 25 '10 at 2:13
    
Great idea! Didn't know this was possible. –  Andrew Strong Feb 25 '10 at 5:15
    
Hi Alexandre, Yeah - I'm aware it could cause issues with some, but it's a start :-). If it's that much of a problem, you could flip the User-Agent stuff and only redirect to WebSVN if it positively matches for Mozilla or such. –  Andy Smith Feb 25 '10 at 12:59

I too tried to get it to work like this, but I don't think it's possible. According to this site, mod_dav_svn generates the html page you see, and it only supports simple skinning using xslt.

What I did was use a new virtual host for my WebSVN content (eg https://websvn.server.local/svn/reponame).

share|improve this answer

Solved it with mod_rewrite as Andy suggested. I am using this set of rules now

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^SVN.*
RewriteRule (.*) - [S=3] 
RewriteRule ^svn$ /svn/ [R,N]
RewriteRule ^svn/$ /websvn/ [R,L]
RewriteRule ^svn/(.*?)(/.*)$ /websvn/listing.php?repname=$1&path=$2 [R,L]

This checks for the User-Agent to start with SVN (this is how Tortoise identifies) and then skips the next three rules.

Those three rules are doing the following:

  • add the trailing slash to the svn-URL (not done automatically because svn is no directory)
  • redirect the direct access to the repository list
  • redirect direct repository view

All this is done in the <Directory>-directive of the RootDir.

Thanks Andy for this hint!

sc911

share|improve this answer
    
No worries - glad it was useful :-) –  Andy Smith Feb 26 '10 at 20:55

Your Answer

 
discard

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.