【问题标题】:htaccess cannot compile regular expressionhtaccess 无法编译正则表达式
【发布时间】:2016-09-02 13:21:00
【问题描述】:

我收到此错误消息:

RewriteRule: 无法编译正则表达式

'([0-9]+)/((?!thumb)[A-Za-z0-9_-\\s]+)\\.([A-Za-z0-9_-\\s]+)$'

而出现这个问题的代码是:

RewriteRule ([0-9]+)/((?!thumb)[A-Za-z0-9_-\s]+)\.([A-Za-z0-9_-\s]+)$ ../members/download.php?u=$1/$2.$3

【问题讨论】:

    标签: regex .htaccess mod-rewrite apache2


    【解决方案1】:

    在你的字符集类中,你有:

    _-\s
    

    这意味着,在这种情况下,捕获所有 ASCII 值介于 _\s 之间的字符。它们如下:

    1. _ 在 95
    2. \s 是 32

    因此,这个范围是无效的;导致错误。

    - 放在类的末尾以使模式起作用:

    RewriteRule ([0-9]+)/((?!thumb)[A-Za-z0-9_\s-]+)\.([A-Za-z0-9_\s-]+)$ ../members/download.php?u=$1/$2.$3
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-07
      • 1970-01-01
      • 1970-01-01
      • 2015-08-12
      • 2015-01-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多