Set WordPress 301 redirection for Nginx on CentOS Server

Source: Internet
Author: User
Tags centos server

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 ;......

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.