RewriteRule with Email Address
I am trying 开发者_如何学JAVAto do a RewriteRule that can include an email address. I think something is wrong with my regular expression.
RewriteRule ^user/verify/([a-zA-Z0-9_-.@]+)/([a-zA-Z0-9]+)/?$ user.php?email=$1&token=$2 [L]
Anyone have any thoughts?
Looking for this:
http://www.example.com/user/user@email.com/sdfdsfa7dfs6dsfa6dsf8/
Use your rule like this:
RewriteRule ^user/verify/([^/]*)/(.*)/?$ user.php?email=$1&token=$2 [L,NC]
This will capture everything between user/verify/
and sdfdsfa7dfs6dsfa6dsf8/
as email address.
One obvious reason that comes to mind is that you're looking for
www.example.com/users/user@email.com/sdfdsfa7dfs6dsfa6dsf8/
But your regex says
^user/verify/([a-zA-Z0-9_-.@]+)/([a-zA-Z0-9]+)/?$
But maybe that's just an error in your question?
As for the email address, there were already many many discussions on this topic: regex+email. There could be email adresses not matching your regex, e.g. with a +
(plus sign) in them.
精彩评论