WordPress Nginx的偽靜態的設置


WordPress Nginx的偽靜態的設置

在站點的配置文件中添加 

在server {} 中添加

 

 location * {
    if (-f $request_filename/index.html){
                    rewrite (.*) $1/index.html break;
            }
    if (-f $request_filename/index.php){
                    rewrite (.*) $1/index.php;
            }
    if (!-f $request_filename){
                    rewrite (.*) /index.php;
            }
    }

 

 

在wp后台設置 

 

下面大致講一下固定鏈接設置參數:

 

1. %year% 基於文章發布年份,比如2007;
2. %monthnum% 基於文章發布月份,比如05;
3. %day% 基於文章發布當日,比如28;
4. %hour% 基於文章發布小時數,比如15;
5. %minute% 基於文章發布分鍾數,比如43
6. %second% 基於文章發布秒數,比如33
7. %postname% 基於文章的postname,其值為撰寫時指定的縮略名,不指定縮略名時是文章標題;
8. %post_id% 基於文章post_id,比如423;
9. %category% 基於文章分類,子分類會處理成“分類/子分類”這種形式;
10. %author% 基於文章作者名。
將上述參數進行組合,即可得到wordpress的固定鏈接形式。網上常見的幾種設置方法:
/%year%/%monthnum%/%day%/%postname%/
/%year%/%monthnum%/%postname%/
/%year%/%monthnum%/%day%/%postname%.html
/%year%/%monthnum%/%postname%.html
/%category%/%postname%.html
/%category%/%post_id%
/%postname%.html
/%post_id%.html 我們一般使用這個方式比較好

 

訪問一下:

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM