【发布时间】:2019-09-08 01:04:01
【问题描述】:
对不起,我不太擅长 Htaccess 和 PHP
我尝试重定向 php 参数,它工作正常。
然后我尝试在 htaccess 中重写 URL,但只有第一个变量有效。
这是我的 PHP(工作正常):
$mobile = $_GET['p'];
$text = $_GET['t'];
header("Location: https://api.whatsapp.com/send?phone=".$mobile."&text=".$text);
网址:https://example.com/?p=60199788474&t=hai
然后是我的 htaccess:
RewriteEngine on
RewriteRule ^([0-9]+)\/?$ index.php?p=$1&t=$2 [NC]
如果我访问:https://example.com/60191111111 那么它将正确重定向。
但是当我访问https://example.com/60191111111/text
那就不行了
谢谢。
【问题讨论】:
-
也许试试
^([0-9]+)\/*.*?$...你需要在最后考虑额外的字符。