[Reprint] WordPress under nginx uses permanent links to configure pseudo-static

First, the wordpress configuration Permalink requires the server to support pseudo-static.

Take Du Niang's explanation of pseudo-static: pseudo-static is relative to real static. Usually, in order to enhance the friendliness of search engines, we generate static pages for the content of articles, but some friends display some information in real time. Or also want to use dynamic scripting to solve some problems. Website content cannot be displayed in a static manner. But this loses the friendly side to search engines. How to find an intermediate method between the two, which leads to pseudo-static technology. It is displayed in the form of static pages such as html, but it is actually handled by dynamic scripts such as ASP.

Draw points:

From the URL structure and page name, pseudo-static and static pages are the same. Pseudo-static page suffix can be html  htm  or directory format

The configuration is to write the rules under the location / of the server object. Many say this:

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

Anyway, I didn't succeed, and finally I read this post http://www.boke8.net/nginx-wordpress-permalink.html  , and realized it like this:

    rewrite ^index.php$ - last;  
    if ( !-e $request_filename ) {  
        rewrite . /wordpress/index.php last;  
    }  

Supplement, for method 1, it is effective after modifying the wordpress site path. The previous picture is convenient, wordpress address and site address are both localhost/wordpress. Considering that such access is extremely unfriendly during actual deployment, the correct posture of the site address should obviously only need the domain name.

 

Reprinted from: https://blog.csdn.net/cscj365/article/details/39551537

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324974165&siteId=291194637