您好,登錄后才能下訂單哦!
小編給大家分享一下wordpress如何去除index.php,希望大家閱讀完這篇文章之后都有所收獲,下面讓我們一起去探討吧!
wordpress去除index.php的方法:首先登錄wordpress后臺;然后依次選擇“設(shè)置-固定鏈接”并設(shè)置好鏈接;接著設(shè)置wordpress重寫規(guī)則;最后在wordpress網(wǎng)站目錄下新建htaccess文件即可。
wordpress去掉index.php的方法
主要有兩個步驟:
1-1) wordpress設(shè)置固定鏈接
登錄wordpress后臺,
依次選擇‘設(shè)置/固定鏈接’
在出現(xiàn)的頁面中,
選擇‘自定義結(jié)構(gòu)’
然后根據(jù)你的情況,
設(shè)置好鏈接。
1-2) 設(shè)置wordpress重寫規(guī)則
這個需要根據(jù)你的web服務(wù)器來決定
1-2-1) wordpress apache靜態(tài)鏈接重寫規(guī)則
如果你是 apache,
在 wordpress 網(wǎng)站目錄下,
新建一個 .htaccess 文件
并寫入下面的代碼
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase /wordpress/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /wordpress/index.php [L] </IfModule>
1-2-2) wordpress nginx 靜態(tài)鏈接重寫規(guī)則
如果你的web服務(wù)器是 nginx,
編輯 nginx 的配置文件 nginx.cnf
在 server {} 配置內(nèi)容中,
寫入下面的代碼
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; } }
然后重啟 nginx
這樣就能把 wordpress 鏈接中的 index.php 去掉。
看完了這篇文章,相信你對“wordpress如何去除index.php”有了一定的了解,如果想了解更多相關(guān)知識,歡迎關(guān)注億速云行業(yè)資訊頻道,感謝各位的閱讀!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。