Htaccess redirect append query string?

I have an htaccess redirect that needs to forward the request string to a new URL, but it will be deleted after the redirect. Can someone tell me what's wrong?

RewriteRule ^services/agents.*$          https://services.example.com/agents/ [R=301,L,QSA]
+3
source share
2 answers

The same rule works on my server. The problem must be something else. I added the same rule on my server and I get the following redirect

http://mysite.com/services/agents/foo?foo=bar => https://services.mysite.com/agents/?foo=bar

, QSA, . , Htaccess .

+2

QSA, . , , , :

RewriteRule ^services/agents.*$ https://services.example.com/agents/?%{QUERY_STRING} [R=301,L]
+2

Source: https://habr.com/ru/post/1711517/


All Articles