Mod Rewrite, pass parameters from URL1 to URL2

I am trying to rewrite the following URL

test.php?par1=foo&par2=bar

IN...

newtest.php?hidden_par=blah&par1=foo&par2=bar

I have this rule that does not work:

RewriteRule ^test.php\??(.*?)$ newtest.php?hiden_par=blah&$1 [L]

Can this be done using RewriteCond or something else? (let's say can this be done?), thanks in advance.

+3
source share
1 answer

You probably need something like a flag QSA("add query string"), which causes the rest of the query string to be correctly appended to the end of the rewritten URL.

For example:

^test.php test.php?hidden=value [L,QSA]
+13
source

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


All Articles