开发者

Apache URL rewrite (mod_rewrite) and uuid

开发者 https://www.devze.com 2023-03-19 08:04 出处:网络
I want to rewrite the following URL in apache: abc.php?id=1234&token=xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx

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 Character开发者_如何学编程s and hyphen in the UUID string, anybody has good idea in apache regex?


This is what you want:

RewriteRule ^/ABC/([0-9]+)/([a-zA-Z0-9\-]+)$ abc.php?id=$1&token=$2

If you want to further validate the token, it would be better to do so in PHP, seeing as that's its intended use.

0

精彩评论

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

关注公众号