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:
So, let's show the effect. Sorry, I got the suffix of. fuck...
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
|