Regex extract number for RewriteRule
For http://macintosh.local/clientname/102
I can get the numeric reference (3 digits) like this: 开发者_JAVA技巧RewriteRule ^[^/]+/([0-9]{3}+)/?$ album.php?ref=$1 [L]
Now I want to get my reference in my SEO URL:
http://macintosh.local/clientname/102-some-keywordsjust replace /? with .*
RewriteRule ^[^/]+/([0-9]{3}+).*$ album.php?ref=$1 [L]
It looks like your existing regex should work just fine. It won't pick up non-numeric characters, after all.
精彩评论