亚洲国产第一_开心网五月色综合亚洲_日本一级特黄特色大片免费观看_久久久久久久久久免观看

Hello! 歡迎來到小浪云!


WordPress 偽靜態(tài)規(guī)則設(shè)置:Apache、Nginx 和二級目錄優(yōu)化


avatar
小浪云 2024-06-29 222


wordpress偽靜態(tài)規(guī)則是根據(jù)服務(wù)器環(huán)境來設(shè)置的,不同的php環(huán)境有不同的偽靜態(tài)設(shè)置方法,常見的php環(huán)境有 apachenginx ,以下分別就這兩種環(huán)境做偽靜態(tài)設(shè)置。

apache規(guī)則:

首先要開啟apache的url_rewrite模塊(一般默認都是開啟的),也就是在httpd.conf中去掉這句話的注釋LoadModule rewrite_module modules/mod_rewrite.so,httpd.conf中找到AllowOverride,把AllowOverride None修改成AllowOverride all

網(wǎng)站根目錄下要有 .htaccess 文件,然后將下面的代碼復(fù)制進去。

    RewriteEngine On

    RewriteBase /

    RewriteRule ^index\.php$ – [L]

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule . /index.php [L]

wordpressapache環(huán)境下二級目錄建站偽靜態(tài)操作方式同上。

nginx規(guī)則:

操作方法:以下代碼加入到網(wǎng)站的配置文件 xxxx.conf 中的 server{} 中。

根目錄下wordpress偽靜態(tài)規(guī)則:

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偽靜態(tài)規(guī)則:

注意將以下代碼中的“二級目錄名”換成自己的真實二級目錄名。

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;

    }

}

相關(guān)閱讀