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]
精彩评论