Reputation: 4907
I am pretty new to Nginx and I was wondering how to do a rewrite. I migrated an old site to a new site and google still has my old ip saved and is returning it in many google search results. I would like to redirect traffic from old to new site with the full URL, and I tried the following.
rewrite ^ http://mysite.com/ permanent;
However, this is mapping http://myoldsite.com/my_controller/my_action/:id?some_get_param=foo&another_get_param=bar
TO
http://mysite.com?some_get_param=foo&another_get_param=bar
How can I make this redirect include my controller and action parameters ( Everything after the base url ) ?
Upvotes: 0
Views: 218
Reputation: 3620
The request_uri
is being stripped during the rewrite. See http://wiki.nginx.org/HttpRewriteModule#rewrite
rewrite ^ http://mysite.com$request_uri? permanent;
Upvotes: 1