荐:Emlog在win server 2008下IIS7.5设置伪静态的方法
下文所示方法是本博客截至发稿日依旧在使用的方法,可以实现博客分类页面、文章页面、自定义单页(内部及外部)、标签页、日期页、微语页等所有页面伪静态。
1.首先创建一个TXT写入以下内容,保存为utf-8格式,写入后重命名为web.config
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="amuker" patternSyntax="Wildcard"> <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"/> </rule> </rules> </rewrite> </system.webServer> </configuration>
2.创建一个TXT,写入以下内容,修改好后命名为httpd.ini
[ISAPI_Rewrite] # 3600 = 1 hour CacheClockRate 3600 RepeatLimit 32 RewriteRule /sitemap.xml /sitemap.xml [L] RewriteRule /photos/(.*) /photos/$1 [L] RewriteRule /rss.php(.*) /rss.php$1 [L] RewriteRule /tb.php(.*) /tb.php$1 [L] RewriteRule /favicon.ico /favicon.ico [L] RewriteRule /xmlrpc.php(.*) /xmlrpc.php$1 [L] RewriteRule /wlwmanifest.xml /wlwmanifest.xml [L] RewriteRule /(t|m)$ /$1/ [R] RewriteRule /(admin|content|include|t|m)/(.*) /$1/$2 [L] RewriteRule /install.php(.*) /install.php$1 [L] RewriteRule /emlog_toolkit.php(.*) /emlog_toolkit.php$1 [L] RewriteRule /up(\d.\d.\d)to(\d.\d.\d).php(.*) /up$1to$2.php$3 [L] RewriteRule ^/$ /index.php [L] RewriteRule /(.*) /index.php/$1 [L]*3.如以上方法不可用,创建一个TXT,写入以下内容,修改好后命名为httpd.conf
[ISAPI_Rewrite] # 3600 = 1 hour CacheClockRate 3600 RepeatLimit 32 RewriteRule /sitemap.xml /sitemap.xml [L] RewriteRule /photos/(.*) /photos/$1 [L] RewriteRule /rss.php(.*) /rss.php$1 [L] RewriteRule /tb.php(.*) /tb.php$1 [L] RewriteRule /favicon.ico /favicon.ico [L] RewriteRule /xmlrpc.php(.*) /xmlrpc.php$1 [L] RewriteRule /wlwmanifest.xml /wlwmanifest.xml [L] RewriteRule /(t|m)$ /$1/ [R] RewriteRule /(admin|content|include|t|m)/(.*) /$1/$2 [L] RewriteRule /install.php(.*) /install.php$1 [L] RewriteRule /emlog_toolkit.php(.*) /emlog_toolkit.php$1 [L] RewriteRule /up(\d.\d.\d)to(\d.\d.\d).php(.*) /up$1to$2.php$3 [L] RewriteRule ^/$ /index.php [L] RewriteRule /(.*) /index.php/$1 [L]
将以上所述几个文件上传到网站根目录即可,友情提示,如果你的网站文章阅读页和单页加入了非HTML页面不可打开的代码,请删除,要删除的代码如下:
<?php$page=isset($params[5])?intval($params[5]):1;$ymurl=$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];$emurl=preg_replace('/(http://|https://|)*/','',Url::log($logid));if($emurl!=$ymurl && $page==1){header('Location:'.Url::log($logid));}?>