一般我們使用wordpress都會(huì)將固定鏈接設(shè)置成偽靜態(tài)的,但是WP卻只能在LINUX系統(tǒng)的服務(wù)器中才能很好的使用,在WINDOWS系統(tǒng)的IIS中設(shè)置偽靜態(tài)會(huì)在前面加上index.php,所以無(wú)法實(shí)現(xiàn)真正的偽靜態(tài)功能。
win主機(jī)下的wordpress文章的鏈接都是http://www.***.com/index.php/123.html類似的鏈,
中間的index.php異常明顯
這里發(fā)菜工作室介紹一種方法
首頁(yè)你的主機(jī)要裝Rewrite 組件,現(xiàn)在國(guó)內(nèi)很多WINDOWS主機(jī)都有裝這個(gè)了。
使用方法:桌面新建一個(gè)txt文檔然后復(fù)制下面的代碼,然后修改文件名為httpd.ini并上傳到網(wǎng)站的根目錄。然后去WP后臺(tái)設(shè)置固定連接:/%post_id%.html
httpd.ini 中加入如下代碼:
- [ISAPI_Rewrite]
- # 3600 = 1 hour
- CacheClockRate 3600
- RepeatLim(如何打造高質(zhì)量外鏈)it 32
- # Protect httpd.ini and httpd.parse.errors files
- # from accessing through HTTP
- # wordpress 偽靜態(tài)規(guī)則
- # For tag(中文標(biāo)簽以及標(biāo)簽翻頁(yè)的規(guī)則)
- RewriteRule /tag/(.*)/page/(d+)$ /index.php?tag=$1&paged=$2
- RewriteRule /tag/(.+)$ /index.php?tag=$1
- # For category(中文分類以及分類翻頁(yè)的規(guī)則)
- RewriteRule /category/(.*)/page/(d+)$ /index.php?category_name=$1&paged=$2
- RewriteRule /category/(.*) /index.php?category_name=$1
- # For sitemapxml
- RewriteRule /sitemap.xml /sitemap.xml [L]
- RewriteRule /sitemap.html /sitemap.html [L]
- RewriteRule /sitemap_baidu.xml /sitemap_baidu.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]