1

i have a big problem with redirect. I'm trying to redirect

www.site.com/article?var=1&var=2

To

www.redirecturl.com/tid=id&var=1&var=2

so i need only to make a redirect passing variable to my new redirect url. How can i do it?

I already tryed with some solutions found on stack but does not works.

Thanks for help.

UPDATE I tryed with this rule:

RedirectMatch 301 "^/article?$" www.redirecturl.com/?tid=trackingid

Redirect work, but don't append any query string from old url :(

1 Answer 1

1

Instead of RedirectMatch directive, you should use mod_rewrite rule with QSA flag:

RewriteEngine On

RewriteRule ^article/?$ http://www.redirecturl.com/?tid=trackingid [L,NC,R=301,QSA]

QSA (Query String Append) flag preserves existing query parameters while adding a new one.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot @anubhava ! Works!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.