Apache URL 重写 (mod_rewrite) 和 uuid
我想在apache中重写以下URL:
abc.php?id=1234&token=xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
其中xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
是一个V4 UUID
我尝试制定如下重写规则:
RewriteRule ^/ABC/([0-9]+)$/^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}.([0-1]){1}/ /abc.php?id=$1&token=$2
但似乎它并没有真正起作用。
我想我不需要一个精确表示 V4 UUID 的正则表达式,但只是简单的正则表达式来表示 UUID 字符串中的字符和连字符,有人对 apache 正则表达式有好主意吗?
I want to rewrite the following URL in apache:
abc.php?id=1234&token=xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
where xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
is a V4 UUID
I have tried to make rewrite rule like:
RewriteRule ^/ABC/([0-9]+)$/^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}.([0-1]){1}/ /abc.php?id=$1&token=$2
but it seems that it's not really working.
I think i dun need a regex that exactly represent a V4 UUID but just simple regex to represent the Characters and hyphen in the UUID string, anybody has good idea in apache regex?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这就是您想要的:
如果您想进一步验证令牌,最好在 PHP 中执行此操作,因为这就是其预期用途。
This is what you want:
If you want to further validate the token, it would be better to do so in PHP, seeing as that's its intended use.