我有一个 apache 配置文件,
<VirtualHost *:443 >
SSLEngine on
SSLCertificateFile ...
SSLCertificateKeyFile ...
SSLCertificateChainFile ...
SSLCACertificateFile ...
ServerName www.etebaran.com
ServerAlias www.etebaran.com etebaran.com
ServerAdmin webmaster@etebaran.com
DocumentRoot /home/etebaran/domains/etebaran.com/private_html
ScriptAlias /cgi-bin/ /home/etebaran/domains/etebaran.com/public_html/cgi-bin/
UseCanonicalName OFF
SuexecUserGroup etebaran etebaran
CustomLog /var/log/httpd/domains/etebaran.com.bytes bytes
CustomLog /var/log/httpd/domains/etebaran.com.log combined
ErrorLog /var/log/httpd/domains/etebaran.com.error.log
ErrorDocument 400 default
ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 405 default
ErrorDocument 408 default
ErrorDocument 410 default
ErrorDocument 411 default
ErrorDocument 412 default
ErrorDocument 413 default
ErrorDocument 414 default
ErrorDocument 415 default
ErrorDocument 500 default
ErrorDocument 501 default
ErrorDocument 502 default
ErrorDocument 503 default
<Location /svn>
#Options -All
DAV svn
SVNPath /home/etebaran/svn/
AuthzSVNAccessFile /home/etebaran/svn/conf/authz
Satisfy Any
Require valid-user
AuthType Basic
AuthName "Etebaran Repository"
AuthUserFile /home/etebaran/svn/conf/.htpasswd
SVNAutoversioning on
</Location>
<Location /trac>
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv /home/etebaran/trac
PythonOption TracUriRoot /trac
Satisfy Any
</Location>
<LocationMatch "/trac/login">
AuthType Basic
AuthName "Etebaran Trac"
AuthUserFile /home/etebaran/svn/conf/.htpasswd
Require valid-user
</LocationMatch>
<Directory /home/etebaran/domains/etebaran.com/private_html>
Options +Includes -Indexes
RewriteEngine On
RewriteCond %{query_string} ^(.*)
RewriteRule (.*) etebaran/_japp/controller.php?__r=$1&%1 [L]
suPHP_Engine ON
suPHP_UserGroup etebaran etebaran
</Directory>
</VirtualHost>
问题是,<Directory>
优先于<Location>
,因此目录上的重写规则会覆盖位置。
奇怪的是,etebaran.com/svn 仍然有效,但 etebaran.com/trac 由目录指令和位于其中的 PHP 框架处理。
我知道有一些讨厌的解决方法,但最整洁的解决方法是什么?