开发者

htaccess regex, allow underscores

Here is our current regex:

RewriteRule ^share/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/?$ /v.php?v=$1&hash=$2 [L]

This isn't allowing underscores "_" - how do we get this to all开发者_开发百科ow underscores?

Thank you


You can shorten your regex like this as well. Now this will allow _ also. \w is shorthand for [a-zA-Z0-9_]

RewriteRule ^share/([\w-]+)/([\w-]+)/?$ /v.php?v=$1&hash=$2 [L]


By adding _ to both expressions within the braces []:

RewriteRule ^share/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/?$ /v.php?v=$1&hash=$2 [L]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜