nginx - Use 301 redirect to change the website to a new domain name and POST is lost
PHP中文网
PHP中文网 2017-05-16 17:13:58
0
3
828

What should I do if using 301 redirection to change the website to a new domain name and get is effective, but post will become invalid and become get?

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(3)
迷茫

Thanks for the invitation.
The current method I can think of is in DNS

New domain name cname Old domain name
Old domain name A record Server IP

It may not be very appropriate, I hope it helps.

Ty80

Post will be ok if you change it to a relative domain name.

漂亮男人

For the 301 response, the browser’s behavior is to send the URL in the GET request Location.
If you need to keep the original POST method unchanged and re-request, you need to use 307, but this may not be what you want, because according to standard browsers, POST requests for 307 require explicit confirmation from the user (for example, an alert will pop up).
For detailed explanation, please refer to the following two articles:

  1. http://www.alanflavell.org.uk...

  2. http://programmers.stackexcha...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!