WordPress Nginx伪静态规则设置以及二级目录规则
WordPress Nginx伪静态规则设置以及二级目录规则(wordpress不是安装在根目录的情况)
根目录下WordPress的伪静态规则:
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;
}
}
二级目录下WordPress的伪静态规则:
注意将以下代码中的“二级目录名”换成自己的真实二级目录名。
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;
}
}
OpenLiteSpeed 二级目录规则伪静态
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteEngine On
RewriteBase /diy/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
location /yinyue/ {你的规则
}