Set WordPress 301 redirection for Nginx on CentOS Server
In the Nginx environment, use 301 for permanent redirection. The code is:
Rewrite ^/archives/(. *)/$1 permanent;
You can also write data separately, for example:
Rewrite ^/archive/(%0-9%%%%%.html $/%1.html permanent; # rewrite ^/archive/category /(. *) $/category/$1 permanent; # directory category rewrite ^/archive/tag /(. *) $/tag/$1 permanent; # tag classification rewrite ^/archive/date /(. *) $/date/$1 permanent; # date category
Permanent indicates that 301 is returned for permanent redirection. The access address of the browser will display the jump URL!
Note that the above 301 redirection code must be placed before the WordPress pseudo-static rule, otherwise it will not take effect! That is:
...... #301 redirection, which must be before pseudo-static; otherwise, rewrite ^/archives /(. *) $/$1 permanent; # wordpress pseudo static rewrite ^. */files /(. *) $/wp-DES/ms-files.php? File = $1 last ;......