I need to preserve the POST data to a different url
The rewrite works but the post data is lost
need to post data from user_info.php to userhistory
You just need to write a Nginx rewrite rule with HTTP status code 307 or 308:
location ~ user_info.php {
return 307 http://testing.com/userhistory;
}
Http Status code 307 or 308 should be used instead of 301 because it changes the request method from POST to GET. Refer
https://tools.ietf.org/id/draft-reschke-http-status-308-07.html#introduction
Also redirecting via return is better compared to rewrite according to nginx doc: https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/#taxing-rewrites