我在我的网站的根目录下使用Apache2以及以下(好).htaccess
,
#OLD (GOOD, IS WORKING!)
# If requested url is an existing file or folder, don't touch it
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule . - [L]
RewriteRule ^(urn|URN):(.+)$ index.php?urn=$2 [L]
RewriteRule ^([a-zA-Z\d\-]+)$ index.php?obj=$1 [L]
现在我需要合并文件夹xWiki
的新条件#NEW: some conflicts, how to preserve old and add /xWiki* behaviour?
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^xWiki/?(.*)$ /xWiki/index.php?title=$1 [L,QSA]
如何"合并"保留除/xWiki
以外的旧行为?
仅添加RewriteRule ^xWiki/?(.*)$
不起作用,而!-f
与同一-f
cond冲突...
答案 0 :(得分:1)
这样做:
#OLD (GOOD, IS WORKING!)
# If requested url is an existing file or folder, don't touch it
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule . - [L]
RewriteRule ^xWiki/(.*)$ /xWiki/index.php?title=$1 [L,QSA]
RewriteRule ^(urn|URN):(.+)$ index.php?urn=$2 [L,QSA]
RewriteRule ^([a-zA-Z\d\-]+)$ index.php?obj=$1 [L,QSA]
RewriteRule
放在正确的位置(在其他RewriteRules之前),并且认为与-f
和!-f
没有冲突({ {1}}是合并解决方案。)。-f
更改为^xWiki/?(.*)$
。