Answer the question
In order to leave comments, you need to log in
How to make a redirect to a new domain in HTACCESS with the replacement of words in the URL?
initial link (for example)
http://sms.example.com/public/http/?user=andrey&pass=andrey123&action=post_sms&target=71234567890&sender=andrey-win&message=privet
http://s1.example.com/sys/send.php?login=andrey&psw=andrey123&sender=andrey-win&phones=71234567890&mes=privet
Answer the question
In order to leave comments, you need to log in
At the beginning of .htaccess add:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^sms\.example\.com$
RewriteCond %{QUERY_STRING} ^user=([^&]+)&pass=([^&]+)&action=post_sms&target=([^&]+)&sender=([^&]+)&message=([^&]+)
RewriteRule ^public/http/$ http://s1.example.com/sys/send.php?login=%1&psw=%2&sender=%4&phones=%3&mes=%5 [R=301,L,NE]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question