<%@ LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <% '/////////////////////////////////////////////////////////////////////////////// '// 插件制作: ZSXSOFT '/////////////////////////////////////////////////////////////////////////////// %> <% Option Explicit %> <% On Error Resume Next %> <% Response.Charset="UTF-8" %> <% Dim RootPath Call System_Initialize() '检查非法链接 Call CheckReference("") '检查权限 If BlogUser.Level>1 Then Call ShowError(6) If CheckPluginState("STACentre")=False Then Call ShowError(48) BlogTitle="静态管理中心" RootPath=Replace(BlogPath,Replace(CookiesPath(),"/","\"),"\") Dim tempString If Request("mak")="1" Then Call SaveToFile(RootPath & "httpd.ini",MakeIIS6Rewrite2(),"iso-8859-1",False) Call SetBlogHint_Custom("创建httpd.ini成功!") End If If Request("mak")="2" Then Call SaveToFile(RootPath & ".htaccess",MakeIIS6Rewrite3(),"utf-8",False) Call SetBlogHint_Custom("创建.htaccess成功!") End If If Request("mak")="3" Then Call SaveToFile(BlogPath & "web.config",MakeIIS7UrlRewrite(),"utf-8",False) Call SetBlogHint_Custom("创建web.config成功!") End If If Request("add")="1" Then tempString=LoadFromFile(RootPath & "httpd.ini","iso-8859-1") If InStr(tempString,"[ISAPI_Rewrite]") Then tempString=Split(tempString,"[ISAPI_Rewrite]")(1) Call SaveToFile(RootPath & "httpd.ini",MakeIIS6Rewrite2() & vbCrLf & tempString,"iso-8859-1",False) Call SetBlogHint_Custom("追加httpd.ini成功!") End If If Request("del")="1" Then Call DelToFile(BlogPath & "httpd.ini") Call SetBlogHint_Custom("删除httpd.ini成功!") End If If Request("del")="2" Then Call DelToFile(BlogPath & ".htaccess") Call SetBlogHint_Custom("删除.htaccess成功!") End If If Request("del")="3" Then Call DelToFile(BlogPath & "web.config") Call SetBlogHint_Custom("删除web.config成功!") End IF Function FileExists(Path) FileExists=0 Dim fso Set fso = CreateObject("Scripting.FileSystemObject") If fso.FileExists(Path) Then FileExists=1 End If Set fso=Nothing End Function %>
<%Call GetBlogHint()%>
<%=BlogTitle%>
<%If ZC_POST_STATIC_MODE="REWRITE" Or ZC_STATIC_MODE="REWRITE" Then%>
" style='border:none;padding:0px;margin:0;' id="tab1">

              请在网站根目录创建httpd.ini文件并把相关内容复制进去,httpd.ini文件必须为ANSI编码,也可以点击按钮生成.


         请在网站根目录创建.htaccess文件并把相关内容复制进去,也可以点击按钮生成..

" style='border:none;padding:0px;margin:0;' id="tab3">

         请在网站"当前目录"创建web.config文件并把相关内容复制进去,也可以点击按钮生成..

<%Else%>

文章及页面和分类页都没有启用动态模式+Rewrite支持,所以没有可用规则.

<%End If%>


<% Function AddRule1(s,regex,page) Dim t,r If regex="ZC_DEFAULT_REGEX" Then r=Replace(ZC_DEFAULT_REGEX,".html","{%page%}\.html") t=t & "RewriteRule "& r &" {%host%}/catalog\.asp\?page=$1" & vbCrlf End If If regex="ZC_CATEGORY_REGEX" Then r=ZC_CATEGORY_REGEX r=Replace(r,"/default.html",IIF(page=True,"{%page%}","")&"/") r=Replace(r,".html",IIF(page=True,"{%page%}","")&".html") t=t & "RewriteRule "& r &" {%host%}/catalog\.asp\?cate=$1"&IIF(page=True,"&page=$2","") & vbCrlf End If If regex="ZC_USER_REGEX" Then r=ZC_USER_REGEX r=Replace(r,"/default.html",IIF(page=True,"{%page%}","")&"/") r=Replace(r,".html",IIF(page=True,"{%page%}","")&".html") t=t & "RewriteRule "& r &" {%host%}/catalog\.asp\?auth=$1"&IIF(page=True,"&page=$2","") & vbCrlf End If If regex="ZC_TAGS_REGEX" Then r=ZC_TAGS_REGEX r=Replace(r,"/default.html",IIF(page=True,"{%page%}","")&"/") r=Replace(r,".html",IIF(page=True,"{%page%}","")&".html") t=t & "RewriteRule "& r &" {%host%}/catalog\.asp\?tags=$1"&IIF(page=True,"&page=$2","") & vbCrlf End If If regex="ZC_DATE_REGEX" Then r=ZC_DATE_REGEX r=Replace(r,"/default.html",IIF(page=True,"{%page%}","")&"/") r=Replace(r,".html",IIF(page=True,"{%page%}","")&".html") t=t & "RewriteRule "& r &" {%host%}/catalog\.asp\?date=$1"&IIF(page=True,"&page=$2","") & vbCrlf End If If regex="ZC_ARTICLE_REGEX" Then r=ZC_ARTICLE_REGEX r=Replace(r,"/default.html",IIF(page=True,"{%page%}","")&"/") r=Replace(r,".html",IIF(page=True,"{%page%}","")&".html") t=t & "RewriteRule "& r &" {%host%}/view\.asp\?id=$1" & vbCrlf End If If regex="ZC_PAGE_REGEX" Then r=ZC_PAGE_REGEX r=Replace(r,"{%name%}","{%alias%}") r=Replace(r,"/default.html",IIF(page=True,"{%page%}","")&"/") r=Replace(r,".html",IIF(page=True,"{%page%}","")&".html") t=t & "RewriteRule "& r &" {%host%}/view\.asp\?id=$1" & vbCrlf End If t=Replace(t,"{%host%}/",CookiesPath()) t=Replace(t,"{%name%}","(?!zb_)(.*)") t=Replace(t,"{%alias%}","(?!zb_)(.*)") t=Replace(t,"{%id%}","([0-9]+)") t=Replace(t,"{%date%}","([0-9\-]+)") t=Replace(t,"{%post%}",ZC_STATIC_DIRECTORY) t=Replace(t,"{%category%}","(?!zb_).*") t=Replace(t,"{%author%}","(?!zb_).*") t=Replace(t,"{%year%}","[0-9\-]+") t=Replace(t,"{%month%}","[0-9\-]+") t=Replace(t,"{%day%}","[0-9\-]+") t=Replace(t,"{%page%}","_([0-9]+)") AddRule1=s & t End Function Function MakeIIS6Rewrite2() Dim s s=s & "[ISAPI_Rewrite]" & vbCrlf s=s & "" & vbCrlf If ZC_STATIC_MODE="REWRITE" Then s = AddRule1(s,"ZC_DEFAULT_REGEX",True) s = AddRule1(s,"ZC_CATEGORY_REGEX",True) s = AddRule1(s,"ZC_CATEGORY_REGEX",False) s = AddRule1(s,"ZC_USER_REGEX",True) s = AddRule1(s,"ZC_USER_REGEX",False) s = AddRule1(s,"ZC_TAGS_REGEX",True) s = AddRule1(s,"ZC_TAGS_REGEX",False) s = AddRule1(s,"ZC_DATE_REGEX",True) s = AddRule1(s,"ZC_DATE_REGEX",False) End If If ZC_POST_STATIC_MODE="REWRITE" Then s = AddRule1(s,"ZC_ARTICLE_REGEX",False) s = AddRule1(s,"ZC_PAGE_REGEX",False) End If MakeIIS6Rewrite2=s End Function Function AddRule2(s,regex,page) Dim t,r If regex="ZC_DEFAULT_REGEX" Then r=Replace(ZC_DEFAULT_REGEX,".html","{%page%}\.html") t=t & "RewriteRule ^"& r &"$ /catalog.asp\?page=$1" & vbCrlf End If If regex="ZC_CATEGORY_REGEX" Then r=ZC_CATEGORY_REGEX r=Replace(r,"/default.html",IIF(page=True,"{%page%}","")&"/") r=Replace(r,".html",IIF(page=True,"{%page%}","")&".html") t=t & "RewriteRule ^"& r &"$ /catalog.asp\?cate=$1"&IIF(page=True,"&page=$2","")&" [NU]" & vbCrlf End If If regex="ZC_USER_REGEX" Then r=ZC_USER_REGEX r=Replace(r,"/default.html",IIF(page=True,"{%page%}","")&"/") r=Replace(r,".html",IIF(page=True,"{%page%}","")&".html") t=t & "RewriteRule ^"& r &"$ /catalog.asp\?auth=$1"&IIF(page=True,"&page=$2","")&" [NU]" & vbCrlf End If If regex="ZC_TAGS_REGEX" Then r=ZC_TAGS_REGEX r=Replace(r,"/default.html",IIF(page=True,"{%page%}","")&"/") r=Replace(r,".html",IIF(page=True,"{%page%}","")&".html") t=t & "RewriteRule ^"& r &"$ /catalog.asp\?tags=$1"&IIF(page=True,"&page=$2","")&" [NU]" & vbCrlf End If If regex="ZC_DATE_REGEX" Then r=ZC_DATE_REGEX r=Replace(r,"/default.html",IIF(page=True,"{%page%}","")&"/") r=Replace(r,".html",IIF(page=True,"{%page%}","")&".html") t=t & "RewriteRule ^"& r &"$ /catalog.asp\?date=$1"&IIF(page=True,"&page=$2","")&" [NU]" & vbCrlf End If If regex="ZC_ARTICLE_REGEX" Then r=ZC_ARTICLE_REGEX r=Replace(r,"/default.html",IIF(page=True,"{%page%}","")&"/") r=Replace(r,".html",IIF(page=True,"{%page%}","")&".html") t=t & "RewriteRule ^"& r &"$ /view.asp\?id=$1 [NU]" & vbCrlf End If If regex="ZC_PAGE_REGEX" Then r=ZC_PAGE_REGEX r=Replace(r,"{%name%}","{%alias%}") r=Replace(r,"/default.html",IIF(page=True,"{%page%}","")&"/") r=Replace(r,".html",IIF(page=True,"{%page%}","")&".html") t=t & "RewriteRule ^"& r &"$ /view.asp\?id=$1 [NU]" & vbCrlf End If t=Replace(t,"{%host%}/","") t=Replace(t,"{%name%}","(?!zb_)(.*)") t=Replace(t,"{%alias%}","(?!zb_)(.*)") t=Replace(t,"{%id%}","([0-9]+)") t=Replace(t,"{%date%}","([0-9\-]+)") t=Replace(t,"{%post%}",ZC_STATIC_DIRECTORY) t=Replace(t,"{%category%}","(?!zb_).*") t=Replace(t,"{%author%}","(?!zb_).*") t=Replace(t,"{%year%}","[0-9\-]+") t=Replace(t,"{%month%}","[0-9\-]+") t=Replace(t,"{%day%}","[0-9\-]+") t=Replace(t,"{%page%}","_([0-9]+)") AddRule2=s & t End Function Function MakeIIS6Rewrite3() Dim s s=s & "#ISAPI Rewrite 3" & vbCrlf s=s & "RewriteBase "& CookiesPath() & vbCrlf If ZC_STATIC_MODE="REWRITE" Then s= AddRule2(s,"ZC_DEFAULT_REGEX",True) s= AddRule2(s,"ZC_CATEGORY_REGEX",True) s= AddRule2(s,"ZC_CATEGORY_REGEX",False) s= AddRule2(s,"ZC_USER_REGEX",True) s= AddRule2(s,"ZC_USER_REGEX",False) s= AddRule2(s,"ZC_TAGS_REGEX",True) s= AddRule2(s,"ZC_TAGS_REGEX",False) s= AddRule2(s,"ZC_DATE_REGEX",True) s= AddRule2(s,"ZC_DATE_REGEX",False) End If If ZC_POST_STATIC_MODE="REWRITE" Then s= AddRule2(s,"ZC_ARTICLE_REGEX",False) s= AddRule2(s,"ZC_PAGE_REGEX",False) End If MakeIIS6Rewrite3=s End Function Function AddRule3(s,regex,page) Dim t,r If regex="ZC_DEFAULT_REGEX" Then r=Replace(ZC_DEFAULT_REGEX,".html","{%page%}\.html") t=t & " " & vbCrlf t=t & " " & vbCrlf t=t & " " & vbCrlf t=t & " " & vbCrlf End If If regex="ZC_CATEGORY_REGEX" Then r=ZC_CATEGORY_REGEX r=Replace(r,"/default.html",IIF(page=True,"{%page%}","")&"/") r=Replace(r,".html",IIF(page=True,"{%page%}","")&".html") t=t & " " & vbCrlf t=t & " " & vbCrlf t=t & " " & vbCrlf t=t & " " & vbCrlf End If If regex="ZC_USER_REGEX" Then r=ZC_USER_REGEX r=Replace(r,"/default.html",IIF(page=True,"{%page%}","")&"/") r=Replace(r,".html",IIF(page=True,"{%page%}","")&".html") t=t & " " & vbCrlf t=t & " " & vbCrlf t=t & " " & vbCrlf t=t & " " & vbCrlf End If If regex="ZC_TAGS_REGEX" Then r=ZC_TAGS_REGEX r=Replace(r,"/default.html",IIF(page=True,"{%page%}","")&"/") r=Replace(r,".html",IIF(page=True,"{%page%}","")&".html") t=t & " " & vbCrlf t=t & " " & vbCrlf t=t & " " & vbCrlf t=t & " " & vbCrlf End If If regex="ZC_DATE_REGEX" Then r=ZC_DATE_REGEX r=Replace(r,"/default.html",IIF(page=True,"{%page%}","")&"/") r=Replace(r,".html",IIF(page=True,"{%page%}","")&".html") t=t & " " & vbCrlf t=t & " " & vbCrlf t=t & " " & vbCrlf t=t & " " & vbCrlf End If If regex="ZC_ARTICLE_REGEX" Then r=ZC_ARTICLE_REGEX r=Replace(r,"/default.html",IIF(page=True,"{%page%}","")&"/") r=Replace(r,".html",IIF(page=True,"{%page%}","")&".html") t=t & " " & vbCrlf t=t & " " & vbCrlf t=t & " " & vbCrlf t=t & " " & vbCrlf End If If regex="ZC_PAGE_REGEX" Then r=ZC_PAGE_REGEX r=Replace(r,"{%name%}","{%alias%}") r=Replace(r,"/default.html",IIF(page=True,"{%page%}","")&"/") r=Replace(r,".html",IIF(page=True,"{%page%}","")&".html") t=t & " " & vbCrlf t=t & " " & vbCrlf t=t & " " & vbCrlf t=t & " " & vbCrlf End If t=Replace(t,"{%host%}/","") t=Replace(t,"{%name%}","(?!zb_)(.*)") t=Replace(t,"{%alias%}","(?!zb_)(.*)") t=Replace(t,"{%id%}","([0-9]+)") t=Replace(t,"{%date%}","([0-9\-]+)") t=Replace(t,"{%post%}",ZC_STATIC_DIRECTORY) t=Replace(t,"{%category%}","(?!zb_).*") t=Replace(t,"{%author%}","(?!zb_).*") t=Replace(t,"{%year%}","[0-9\-]+") t=Replace(t,"{%month%}","[0-9\-]+") t=Replace(t,"{%day%}","[0-9\-]+") t=Replace(t,"{%page%}","_([0-9]+)") AddRule3=s & t End Function Function MakeIIS7UrlRewrite() Dim s s=s & "" & vbCrlf s=s & "" & vbCrlf s=s & " " & vbCrlf s=s & " " & vbCrlf s=s & " " & vbCrlf If ZC_STATIC_MODE="REWRITE" Then s= AddRule3(s,"ZC_DEFAULT_REGEX",True) s= AddRule3(s,"ZC_CATEGORY_REGEX",True) s= AddRule3(s,"ZC_CATEGORY_REGEX",False) s= AddRule3(s,"ZC_USER_REGEX",True) s= AddRule3(s,"ZC_USER_REGEX",False) s= AddRule3(s,"ZC_TAGS_REGEX",True) s= AddRule3(s,"ZC_TAGS_REGEX",False) s= AddRule3(s,"ZC_DATE_REGEX",True) s= AddRule3(s,"ZC_DATE_REGEX",False) End If If ZC_POST_STATIC_MODE="REWRITE" Then s= AddRule3(s,"ZC_ARTICLE_REGEX",False) s= AddRule3(s,"ZC_PAGE_REGEX",False) End If s=s & " " & vbCrlf s=s & " " & vbCrlf s=s & " " & vbCrlf s=s & "" & vbCrlf MakeIIS7UrlRewrite=s End Function %>