0

The apache rewrite module (apache 2.4) gives me headaches, I need your help.

I try to redirect my unlogged users to another url and pass the original url as a callback argument. When the url below is called : http://myapp.com/context?arg1=value1&arg2=value2 then the user is redirected to :

http://myloginapp.com?callback=http%3A%2F%2Fmyapp.com%2Fcontext%3Farg1%3Dvalue1%26arg2%3Dvalue2

I have tried many flags ([NE], [B]) in my rewrite clause and tried some rewrite cond found in the forum without success...

icedmac
  • 1
  • 2
  • Possible duplicate of [Redirect all traffic to holding page unless logged in using .htaccess](https://stackoverflow.com/questions/15562941/redirect-all-traffic-to-holding-page-unless-logged-in-using-htaccess) – pringi Oct 03 '17 at 15:11

1 Answers1

0

I think a found a part of the solution with :

RewriteCond %{QUERY_STRING} (.*)&(.*)
RewriteRule /(.*)$ https://myloginapp.com/?callback=http://myapp.com/$1\?%1_%2 [N]

With the N flag I can repeat the rewrite as long as & remains in the url. But it doesn't work when i try to replace the underscore in %1_%2 with %26. And if I try to add the NE flag, apache can't compile the rule (N and NE flags are not allowed together ?).

icedmac
  • 1
  • 2