wordpress去掉win主機鏈接中的index.php

字號:


    從來未用過WIN主機,所以本人對這個問題也未研究過,今天幫別人弄了一下,還是很簡單,記錄一下方便有同樣問題的童鞋查詢。
    打開記事本,把下面代碼粘貼進去:
    [ISAPI_Rewrite]
    # 3600 = 1 hour
    CacheClockRate 3600
    RepeatLimit 32
    # Protect httpd.ini and httpd.parse.errors files
    # from accessing through HTTP
    # Rules to ensure that normal content gets through
    RewriteRule /sitemap.xml /sitemap.xml [L]
    RewriteRule /favicon.ico /favicon.ico [L]
    # For file-based wordpress content (i.e. theme), admin, etc.
    RewriteRule /wp-(.*) /wp-$1 [L]
    # For normal wordpress content, via index.php
    RewriteRule ^/$ /index.php [L]
    RewriteRule /(.*) /index.php/$1 [L]
    保存時保存類型選擇“所有文件”,并輸入文件名稱:httpd.ini
    將這個httpd.ini文件上傳到WP程序所在的目錄也就是與index.php在同一個目錄內(nèi)。
    之后進入WP后臺修改固定鏈接,比如:/%category%/%post_id%.html
    刷新博客首頁,打開文章鏈接看看鏈接地址中的index.php是不是消失了。
    另外,網(wǎng)上還有說使用cos-html-cache靜態(tài)化插件也可以實現(xiàn),個人建議不要使用此方法,靜態(tài)化插件也是我強烈建議新手不要用的一個插件,之前寫過一篇:淺談WordPress靜態(tài)化,對個人小博靜態(tài)化插件,對你沒有任何用處,只會帶來無盡的問題,而且很多新手在知道很多問題是靜態(tài)化插件造成的后,直接刪除插件,這是錯誤的,拿cos- html-cache靜態(tài)化插件為例,刪除插件前,應(yīng)首先進入插件設(shè)置頁面,清除緩存,之后再刪除插件,不然緩存文件依然存在,頁面顯示的還是靜態(tài)化后的內(nèi)容,插件刪除也不會再更新了。