發(fā)布時(shí)間:2016/2/23 15:58:18 關(guān)注:1839
為方便網(wǎng)站修改維護(hù)偽靜態(tài)規(guī)則,本站放出自己使用的網(wǎng)站偽靜態(tài)規(guī)則生成小程序。
PS:網(wǎng)站偽靜態(tài)能夠提高網(wǎng)站訪問(wèn)體驗(yàn),增加搜索引擎對(duì)網(wǎng)站的收錄,是SEOER必不可少的SEO法寶之一。
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<% dim rulePath
rulePath="/.htaccess"
%>
<style type="text/css">
form textarea{ border:#ececec solid 3px; background:#F8F8F8}
input[type="submit"]{ height:35px; width:100px;}
</style>
<form name="form1" method="post" action="?act=1">
<p>
<label for="rullContent"></label>
<textarea name="rullContent" id="rullContent" cols="90" rows="20"><%=FsoReadFile(rulePath) %></textarea></p>
<p><input type="submit" name="button" id="button" value="提交"></p>
</form>
<%
'========讀取原來(lái)的規(guī)則=======================
Function FsoReadFile(filePath)
dim objFSO,objCountFile
filePath=server.MapPath(filePath)
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
IF objFSO.FileExists(filePath)=true Then'判斷文件是否存在和文件有內(nèi)容
if objFSO.getfile(filePath).Size>0 then
Set objCountFile = objFSO.OpenTextFile(filePath,1,True)
FSOReadFile = objCountFile.ReadAll
objCountFile.Close
Set objCountFile=Nothing
else
Response.Write("定義規(guī)則為空,請(qǐng)開(kāi)始定義規(guī)則")
end if
Else
Response.Write("您還未開(kāi)通,點(diǎn)擊獲按鈕取即可開(kāi)通")
End if
Set objFSO = Nothing
End Function
'=============創(chuàng)建規(guī)則========================
Function createFile(filePath,objStr )
Dim fileObj,objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
'刪除原來(lái)的文件
IF objFSO.FileExists(filePath)=true Then
objFSO.DeleteFile (filePath)
else
objFSO.CreateTextFile (filePath)
End IF
'獲取連接信息
Set fileObj = objFSO.opentextfile(filePath,2,true) '
fileObj.Writeline objStr '向文件寫(xiě)入數(shù)據(jù),覆蓋形式寫(xiě)入
Set objFSO = Nothing
End Function
if clng(request.QueryString("act"))=1 then
call createFile(rulePath,request.Form("rullContent"))
Response.Write("<script>alert('成功生成偽靜態(tài)文件!');this.location.href='reWrite.asp';</script>")
end if
%>
點(diǎn)擊下載:偽靜態(tài)生成
地址:山東省濰坊奎文區(qū)新華路樂(lè)川街華誼大廈三樓
網(wǎng)址:http://www.hlygmc.cn/ 垂詢(xún)電話:
網(wǎng)站備案:魯ICP備14027302號(hào)-5
copyright© 濰坊華邦網(wǎng)絡(luò)有限公司2011-2025