WP偽靜態(tài)對(duì)于Linux主機(jī)是十分容易的事情,但在Windows主機(jī)IIS環(huán)境下就比較棘手了,你是否遇到了一樣的問(wèn)題呢?今天就來(lái)教你如何在Win主機(jī)IIS環(huán)境下進(jìn)行WP偽靜態(tài)配置。
Windows主機(jī)IIS環(huán)境下偽靜態(tài)需要主機(jī)啟用了Rewrite模塊,不然是不會(huì)起作用的。主機(jī)啟用了Rewrite模塊,剩下的只需要一個(gè)Httpd.ini就能解決問(wèn)題了。
httpd.ini是指wordpress程序在windows虛擬主機(jī)上的偽靜態(tài)設(shè)置。下面就貼出WP偽靜態(tài)的Httpd.ini代碼:
[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] RewriteRule /sitemap_baidu.xml /sitemap_baidu.xml [L] RewriteRule /sitemap.html /sitemap.html [L] RewriteRule /archivers/(.*) /archivers/$1 [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]把上面的代碼復(fù)制保存為httpd.ini文件,上傳至網(wǎng)站根目錄即可。