Trombone0904
Trombone0904

Reputation: 4268

htacces rule with url variable to external url

I have the following htaccess rule:

RewriteRule ^whatsapp$ https://web.whatsapp.com [L,NC]

Result:

If I call www.mydomain.de/whatsapp -> I will redirect to https://web.whatsapp.com

Now I would like realize this situation:

I call www.mydomain.de/whatsapp=1234567 -> I will redirect to https://web.whatsapp.com/send?phone=1234567

Can anybody helps me? Thanks !

Upvotes: 0

Views: 22

Answers (1)

anubhava
anubhava

Reputation: 785256

You may use 2 different rules:

RewriteRule ^whatsapp/?$ https://web.whatsapp.com [L,NC,R=302]

RewriteRule ^whatsapp=([\w-]+)/?$ https://web.whatsapp.com/send?phone=$1 [L,NC,R=302,QSA]

Upvotes: 1

Related Questions