3
我需要一些重写帮助。重写URL以匹配Locationmatch
有两个规则需要被应用:1. 基地的RewriteCond上HTTP_USER_AGENT 2.添加路径到URL,以配合LocationMatch
什么我现在它被打破:
RewriteCond %{HTTP_USER_AGENT} ^git
RewriteRule ^(.*)$ /git/$1 [L]
删除RewriteRule并立即查询路径工作正常,但运行此规则呈现apache“无法找到文件”。
这场比赛是一个LocationMatch <LocationMatch "/git/">
,所以我不确定一个RewriteRule是否可以指向那个?
完整配置:
<VirtualHost *:80>
DocumentRoot /home/subgit/repos
<Directory /home/subgit/repos>
Options None
AllowOverride none
Order allow,deny
Allow from all
</Directory>
CustomLog /home/subgit/logs/access_log combined
SuexecUserGroup subgit subgit
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^git
RewriteRule ^(.*)$ /git/$1 [L]
RewriteCond %{QUERY_STRING} service=git-receive-pack [OR,NC]
RewriteCond %{REQUEST_URI} ^/git/.*/git-receive-pack$ [NC]
RewriteRule .* - [E=AUTHREQUIRED:yes]
ScriptAlias /git/ /home/subgit/bin/gitolite-suexec-wrapper.sh/
<LocationMatch "/git/">
Order Allow,Deny
Deny from env=AUTHREQUIRED
Allow from all
Satisfy Any
AuthType Basic
AuthName "subgit"
AuthBasicProvider file
AuthUserFile /home/subgit/etc/subgit
Require valid-user
</LocationMatch>
</VirtualHost>
由于