Intercepting backend 301/302 redirects (proxy_pass) and rewriting to another location block possible?

You could use proxy_redirect directive: http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_redirect Nginx will still return 301/302 to the client but proxy_redirect will modify Location header and the client should make a new request to the URL given in the Location header. Something like this should make the subsequent request back to nginx: proxy_redirect http://upstream:port/ http://$http_host/;

.htaccess 301 redirect of single page

RedirectMatch uses a regular expression that is matched against the URL path. And your regular expression /contact.php just means any URL path that contains /contact.php but not just any URL path that is exactly /contact.php. So use the anchors for the start and end of the string (^ and $): RedirectMatch 301 ^/contact\.php$ /contact-us.php

What’s the difference between HTTP 301 and 308 status codes?

An overview of 301, 302 and 307 The RFC 7231, the current reference for semantics and content of the HTTP/1.1 protocol, defines the 301 (Moved Permanently) and 302 (Found) status code, that allows the request method to be changed from POST to GET. This specification also defines the 307 (Temporary Redirect) status code that doesn’t … Read more