最近一哥们网站原来用的是WIN2003服务器。后来换空间以后IIS为8.0的。服务商说只支持web.config。规则要改变。无语啊。都没弄过这个。经过搜索和研究终于搞定。被大家说得太复杂了。其实参考下觉得并不太难
原有Rewrite
代码如下 | 复制代码 |
[ISAPI_Rewrite] # 3600 = 1 hour CacheClockRate 3600 RepeatLimit 32 RewriteRule ^/index.html$ /index.php [N,I] RewriteRule ^(.*)/index.html $1/index.php [I] RewriteRule ^(.*)/page([0-9]+).html $1/index.php?gid=$2 [I] RewriteRule ^(.*)/list-([0-9]+).html $1/index.php?PageNo=$2 [I] RewriteRule ^(.*)/show-aid([0-9]+).html $1/show.php?uid=$2 [I] |
更改以后的web.config
代码如下 | 复制代码 |
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <staticContent> <mimeMap fileExtension=".bat" mimeType="text/bath" /> </staticContent> <rewrite> <rules> <rule name="home Index"> <match url="^index.html$" ignoreCase="false" /> <action type="Rewrite" url="index.php" appendQueryString="false" /> </rule> <rule name="page Index"> <match url="^(.*)/index.html$" ignoreCase="false" /> <action type="Rewrite" url="{R:1}/index.php" appendQueryString="false" /> </rule> <rule name="page List"> <match url="^(.*)page([0-9]+).html$" ignoreCase="false" /> <action type="Rewrite" url="{R:1}/index.php?gid={R:2}" appendQueryString="false" /> </rule> <rule name="list Page"> <match url="^(.*)list-([0-9]+).html$" ignoreCase="false" /> <action type="Rewrite" url="{R:1}/.php?PageNo={R:2}" appendQueryString="false" /> </rule> <rule name="show Page"> <match url="^(.*)show-aid([0-9]+).html$" ignoreCase="false" /> <action type="Rewrite" url="{R:1}/show.php?uid={R:2}" appendQueryString="false" /> </rule> </rules> |
时间: 2024-10-05 11:28:46