1、利用iis自带的httpd.ini文件
在网站根目录新建一个httpd.ini 内容如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | [ISAPI_Rewrite] # 3600 = 1 hour CacheClockRate 3600 RepeatLimit 32 # ISAPI_Rewrite 1.3 版本 域名的301重定向 RewriteCond Host: ^xmspace.net$ RewriteRule (.*) http://www.xmspace.net$1 [I,R] # Protect httpd.ini and httpd.parse.errors files # from accessing through HTTP # For tag(中文标签以及标签翻页的规则) RewriteRule /tag/(.*)/page/(d+)$ /index.php?tag=$1&paged=$2 RewriteRule /tag/(.+)$ /index.php?tag=$1 # For category(中文分类以及分类翻页的规则) 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.xml.gz /sitemap.xml.gz [L] RewriteRule /robots.txt /robots.txt [L] RewriteRule /favicon.ico /favicon.ico [L] #子目录,如果不添加子目录会404 RewriteRule /webimg/(.*) /webimg/$1 [L] RewriteRule /gg/(.*) /gg/$1 [L] # For file-based wordpress content (i.e. theme), admin, etc. RewriteRule /wp-(.*) /wp-$1 [L] RewriteRule /wp-admin/(.*) /wp-admin/$1 [L] # For normal wordpress content, via index.php RewriteRule ^/$ /index.php [L] RewriteRule /(.*) /index.php/$1 [L] |