Subversion的Repository列表完美解决方案
授权方式:署名,非商业用途,保持一致,转载时请务必以超链接(http://www.fwolf.com/blog/post/60)的形式标明文章原始出处和作者信息及本声明。我的SVN项目都放在h:/svn下,在Apache中只是把这个目录设置成了虚拟目录,这样我可以方便的通过http://localhost/svn/project1访问这个目录下的所有Repository,但如果我想访问http://localhost/svn/,是得不到所有Repository列表的,只是一个403 Forbidden错误,在TortorseSVN的帮助中有这么一篇文章中提到了解决的方法,下面是我的具体实施和一点心得。
SVN在Apache中的配置段一般都用<Location>,我尝试过使用<Directory>,好像也可以,但不管用那个,在配置中无法使用AllowOverride指令,也就是说.htaccess文件无法使用。因此,若想把http://localhost/svn/转向到调用其它文件,只能使用Rewrite module,并且必须写在<Location>段之外。我就是在这里试了N久 :(。
(Apache一般配置和PHP、Rewrite module安装略过)
为了方便管理,用于显示Repository列表的PHP文件放在了h:/svn/svntools/目录,也就是在SVN的根目录下 :-)。因此,Apache中的这段配置如下:
Alias /svntools "h:/svn/svntools"
RewriteEngine on
RewriteRule ^/svn/$ /svntools/svn_index.php [PT]
<Location /svn>
DAV svn
SVNParentPath h:/svn
</Location>
先用Alias定义到h:/svn/svntools的虚拟目录,这样就可以访问到svn_index.php文件了,然后打开RewriteEngine,使用RewriteRule将到/svn/的访问重定向到/svntools/svn_index.php文件,通过执行这个文件就会产生Repository列表了;最后是SVN虚拟目录的配置。
No tags for this post.
Save to Browser Favorites
Ask
backflip
blinklist
BlogBookmark
Bloglines
BlogMarks
Blogsvine
BUMPzee!
CiteULike
co.mments
Connotea
del.icio.us
DotNetKicks
Digg
diigo
dropjack.com
dzone
Facebook
Fark
Faves
Feed Me Links
Friendsite
folkd.com
Furl
Google
Hugg
Jeqq
Kaboodle
linkaGoGo
LinksMarker
Ma.gnolia
Mister Wong
Mixx
MySpace
MyWeb
Netvouz
Newsvine
PlugIM
popcurrent
Propeller
Reddit
Rojo
Segnalo
Shoutwire
Simpy
sk*rt
Slashdot
Sphere
Sphinn
Spurl.net
Squidoo
StumbleUpon
Technorati
ThisNext
Webride
Windows Live
Yahoo!
Email This to a Friend
If you like this then please subscribe to the