目前网上到处都是自己的博客搭建,基于linux或者win主机,国外一般是linux,国内IDC服务商为了解决问题的方面,一般都选择具有图形界面的win主机,但服务器出现问题频率较高的是win主机,因为win主机配置比较麻烦。那么回到主题上来,要想实现伪静态,各个主机都有对应的Rewrite伪静态规则。其中linux操作系统的主机是.htaccess 格式的规则,Windows server 2003 操作系统的主机httpd.ini 格式的规则,Windows server 2008 操作系统的主机web.config 格式的规则。那么今天就为大家奉上wordpress在win主机的伪静态规则(typecho部分适用)。
1、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] # 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]
2、web.config 格式规则:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="WordPress" stopProcessing="true"> <match url="^(.*)$" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php" appendQueryString="true"/> </rule> </rules> </rewrite> </system.webServer> </configuration>