2010-09-12 46 views
0

我有我的Subversion存儲庫以下virtuslhost,我想創建一個總是指向最新的穩定標籤的鏈接。我嘗試使用mod_rewrite。它被apache接受沒有任何錯誤,但不會工作。 我也試着重寫。*這似乎是不行的(是的,我重新啓動Apache)的svn每Apache與mod_rewrite

<VirtualHost svn.warsow-race.net> 
    ServerAdmin    [email protected] 
    ServerName    svn.warsow-race.net 

    ErrorLog    /srv/svn/error.log 
    CustomLog    /srv/svn/access.log combined 

    RewriteEngine On 
    RewriteRule ^/racesow0.5/latest-stable(.*) /racesow0.5/tags/0.5.4-stable$1 

    <Location /> 
      DAV svn 
      SVNParentPath /srv/svn 
    </Location> 

    <Location /racesow0.5> 
      AuthType Basic 
      AuthName "Racesow 0.5" 
      AuthUserFile /srv/svn/racesow.passwd 
      <LimitExcept GET OPTIONS PROPFIND REPORT> 
        Require valid-user 
      </LimitExcept> 
    </Location> 
</VirtualHost> 

重寫日誌說

(2) init rewrite engine with requested uri /racesow0.5/latest-stable/sdk 
(3) applying pattern '^/racesow0.5/latest-stable(.*)' to uri '/racesow0.5/latest-stable/sdk' 
(2) rewrite '/racesow0.5/latest-stable/sdk' -> '/racesow0.5/tags/0.5.4-stable/sdk' 
(2) local path result: /racesow0.5/tags/0.5.4-stable/sdk 
(2) prefixed with document_root to /htdocs/racesow0.5/tags/0.5.4-stable/sdk 
(1) go-ahead with /htdocs/racesow0.5/tags/0.5.4-stable/sdk [OK] 

但打電話時我得到沒有找到404

+0

配置中的「ReweiteEngine」輸入錯誤? – Nick 2010-09-12 21:39:20

+0

此外,最好不要crosspost(http://superuser.com/questions/187856/svn-per-apache-with-mod-rewrite) – Nick 2010-09-12 21:40:05

+0

它只是在這張貼錯字 – 2010-09-12 21:45:14

回答

1

這不會工作作爲顛覆會做的位置之上的請求,然後涉及到一些「神奇」看着你的訪問日誌,看看什麼是真正要求:

/racesow0.5/!svn/vcc/[...] 
/racesow0.5/!svn/bc/888/[...] 

我不知道它究竟是如何工作的,但簡單地「重寫」r equest將不起作用。

我建議創建一個文件夾「/racesow0.5/latest-stable」,並將svn:external放入此文件夾中指向您的最新版本。

+0

聽起來不錯,我會盡力 – 2010-09-12 22:14:01

+0

HM不能使它工作 – 2010-09-12 22:25:36

+0

添加的文件夾/ repp /最新,並在此文件夾中添加的svn:externals的最新網址,那麼你就可以檢出/最新,並得到fodler穩定包含目標:) – 2010-09-12 22:37:09

1

The mod_rewrite documentation (請參閱「按目錄重寫」)表示您應該避免將指令放入<Location>節中,並將其聲明爲「不受支持」。我必須檢查源代碼,看看實際上有什麼影響,但最好避免它。

我建議試圖移出你的規則到<VirtualHost>,然後還要PT(直通)的情況下,任何其他模塊需要重寫的路徑正確的訪問重寫:

<VirtualHost svn.warsow-race.net> 
    ... 
    ReweiteEngine On 
    RewriteRule ^/racesow0.5/latest-stable(.*) /racesow0.5/tags/0.5.4-stable$1 [PT] 
    ... 
</VirtualHost> 
+0

已經試過,但沒有效果 – 2010-09-12 21:50:30

+0

@zolex - 嗯..也許你應該設置['RewriteLog'](http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritelog)來查看是否正在調用'mod_rewrite'第一個地方。目前,當您嘗試查看'/ racesow0.5/latest-stable'時,您將獲得404s? – 2010-09-12 21:58:39

+0

我只是這樣做並更新我的問題是 – 2010-09-12 22:01:52