Noelia Belen Lopez
Noelia Belen Lopez

Reputation: 126

Redirect preserving query strings

I want to all my request to www.example.com/original-link go to www.newsite.com but preserving original query strings and adding some more

Example:

www.example.com/original-link?param_request=value1

Go to

www.newsite.com?param_request=value1&new_param=value2

Upvotes: 0

Views: 54

Answers (2)

Wiimm
Wiimm

Reputation: 3615

php solution:

header('Location: http.//www.newsite.com?param_request='
            . $value1 . '&new_param=' .$value2);
die();

$value1 is usually computed by $_GET[]

Upvotes: 1

anubhava
anubhava

Reputation: 786091

You can use this rule in site root .htaccess of old site:

RewriteEngine On

RewriteRule ^original-link/?$ http://newsite.com?new_param=value2 [L,NC,QSA,R=301] 

Upvotes: 0

Related Questions