Rewrite Rules for wordpress in nginx

Source: Internet
Author: User
Tags nginx server

Rewrite Rules for wordpress in nginx:

[Root @ localhost ~] # Cat/etc/nginx/wprw. conf

The code is as follows: Copy code

Rewrite ^. */files/(. *) $/wp-nodes des/ms-files.php? File = $1 last;

If (! -E $ request_filename ){

Rewrite ^. +? (/Wp-. *) $1 last;

Rewrite ^. +? (/. *. Php) $1 last;

Rewrite ^/index. php last;

}

Configure the Nginx server:

Nginx rewrite for wordpress

Go to the background, choose Settings> fixed link> Custom

The code is as follows: Copy code
/% Category %/define post_id).html


First, let's take a look at the basic parameters of fixed links that can be used in the official wordpress list:
% Year %
Based on the publishing year of the article, such as 2009;
% Monthnum %
Based on the published month of the article, such as 12;
% Day %
Based on the published date of the article, such as 28;
% Hour %
Based on the article publishing hours, such as 15;
% Minute %
Based on the number of articles published in minutes, such as 43;
% Second %
Based on article publishing seconds, such as 33;
% Postname %
Based on the postname of the article, the value is the abbreviation name specified at the time of writing, and the title of the article is not specified;
% Post_id %
Based on the post _id, such as 888;
% Category %
Based on the document classification, subcategories are processed in the form of "category/subcategory;
% Author %
Based on the author's name, such as rocdk890.

Set wordpress Fixed link for test:

Custom Links

So, let's show the effect. Sorry, I got the suffix of. fuck...

Hello world one


Combine the above parameters to get the fixed link form of wordpress. Several common setting methods on the Internet:

 

The code is as follows: Copy code
1./% year %/% monthnum %/% day %/% postname %/
2./% year %/% monthnum %/% postname %/
3./% year %/% monthnum %/% day %/your postname).html
4./% year %/% monthnum %/invalid postname).html
5./% category %/your postname).html
6./configure post_id).html

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.