How can I convert 302 to 301 redirect?
-
17-02-2021 - |
Frage
https://newsite.com to https://www.newsite.com
results in a 302 redirect. Not sure from where this temporary redirect is coming. Site nginx configuration has only 301 redirects. Here is the configuration.
https://stackoverflow.com/questions/54603417/nginx-301-redirect-from-oldsite-to-newsite
Lösung
I guess the 302 redirect comes from Magento, because you call without the configured host in your url.
Try something like this in your nginx:
if ($host != 'www.newsite.com'){
return 301 https://www.newsite.com$request_uri
}
Andere Tipps
For each redirect, you can add the following line to your nginx configuration, inside of the location / block (first):
rewrite /old/url.html /new/url.html
I hope this will help
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit magento.stackexchange