【问题标题】:Regex extract number for RewriteRuleRewriteRule 的正则表达式提取编号
【发布时间】:2010-02-15 22:15:42
【问题描述】:

对于http://macintosh.local/clientname/102
我可以像这样得到数字参考(3位数字):

RewriteRule ^[^/]+/([0-9]{3}+)/?$ album.php?ref=$1 [L]

现在我想在我的 SEO URL 中获得我的参考:
http://macintosh.local/clientname/102-some-keywords

【问题讨论】:

    标签: regex numbers extract mod-rewrite


    【解决方案1】:

    只需替换 /?带 .*

    RewriteRule ^[^/]+/([0-9]{3}+).*$ album.php?ref=$1 [L]
    

    【讨论】:

      【解决方案2】:

      看起来您现有的正则表达式应该可以正常工作。毕竟,它不会提取非数字字符。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-01-27
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多