问题描述
我有以下htaccess规则:
RewriteRule ^whatsapp$ https://web.whatsapp.com [L,NC]
结果:
If I call www.mydomain.de/whatsapp -> I will redirect to https://web.whatsapp.com
现在我想意识到这种情况:
I call www.mydomain.de/whatsapp=1234567 -> I will redirect to https://web.whatsapp.com/send?phone=1234567
有人可以帮助我吗? 谢谢!
解决方法
您可以使用2条不同的规则:
RewriteRule ^whatsapp/?$ https://web.whatsapp.com [L,NC,R=302]
RewriteRule ^whatsapp=([\w-]+)/?$ https://web.whatsapp.com/send?phone=$1 [L,R=302,QSA]