@johannes_hirshfeld

Как сделать перенаправление на новый domen в HTACCESS с заменой слов в URL?

начальная ссылка (например)
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


меняются:
user на login
pass на psw
target на phones
message на mes

action=post_sms можно оставить

спасибо
  • Вопрос задан
  • 41 просмотр
Пригласить эксперта
Ответы на вопрос 1
@dodo512
В начало .htaccess добавить:
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]
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы