I am trying to redirect every url from a domain to a second "domain" and to keep the url part after the "/".
Here's an example of what I'm trying to do:
When someone visits mydomain.com/any-url
he should get redirected to urltracker.com/events/redirect_to=http%253A%252F%252Fseconddomain.com%252Fany-url
I'm currently using
RewriteRule ^(.*)$ http://urltracker.com/events/redirect_to=http%253A%252F%252Fwww.seconddomain.com%252F$1 [R=301,L]
But this code redirects me to urltracker.com/events/redirect_to=http53A52F52Fseconddomain.com52Fany-url
Every "%2" disappears. Can you guys help me change the htaccess so it will not replace %2 ?
Edit: What I actually need is to have all special characters after "redirect_to=" double encoded.
You can check : http://stackoverflow.com/a/6529394/1079254
Maybe you will need "AllowEncodedSlashes On" because I think you will have a problem with slash in your 'redirect_to' parameter.
I think I will try to do it in PHP. I managed to keep the characters in double encoded form by using "\", problem is that I want the "any-url" part to have only slashes double encoded, not every special character. Currently, it will double encode every special character, I don't think I can select somehow to only encode slashes.