我在 mod_rewrite 正则表达式中使用匹配量词 {},如果量词匹配 1 或 2 次,则重写规则工作,如果匹配 3 次或更多次则不工作。为什么?
.htaccess 文件示例:
这项工作(我需要 mydomain.com/download.ex ):
RewriteEngine On
RewriteRule ^download\..{1,2}$ /download.php [L]
但这不起作用,500 错误,只更改了 2 到 3 个最大量词(我需要 mydomain.com/download.exe ):
RewriteEngine On
RewriteRule ^download\..{1,3}$ /download.php [L]
这太棒了,但它是真实的。为什么会这样?
ps版本:
root@andrey:/var/www/default/www# apache2 -v
Server version: Apache/2.4.7 (Ubuntu)
Server built: Jul 22 2014 14:36:38
root@andrey:/var/www/default/www# uname -a
Linux mydomain.com 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
root@andrey:/var/www/default/www# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release: 14.04
Codename: trusty