18 个解决方案
#1
什么意思 你是指生成静态页面吗?
#2
<%
Set Rs=Server.CreateObject("Adodb.Recordset")
StrSQL="select * from WebInfo"
Rs.Open StrSQL,DbConn,1,1
If Rs.EOF Then
Else
path5="../html/" '这个为生成后文件路径
Do While Not rs.eof
filename=Replace(Replace(Replace(rs("Add_Date"),":",""),"-","")," ","")&".html" '这个为生成后的文件名
url="http://localhost/default/Web/Info_Body.asp?ID="&Rs("ID") '这个为动态页面地址,必须是http://****.asp格式的
StrSQL="Update WebInfo Set Html_URL='"&filename&"' Where ID="&Rs("ID")
DbConn.Execute StrSQL
Call createhtml(url,filename,path5)
rs.movenext
loop
End If
rs.close
Set rs=Nothing
Set conn=nothing
%>
<%
'功能:读取数据库内容,生成静态页面
'来自:www.aspprogram.cn
'作者:wangsdong
'参数说明:
' url是动态页面的地址,必须是http://*****/**.asp格式
' filename为生成后的文件名
' path为存储生成后文件的文件夹名
'备注:支持原创程序,请保留此信息,谢谢
Function createhtml(url,filename,path)
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
path1=server.mappath(path)&"\"&filename
Set MyTextFile=MyFileObject.CreateTextFile(path1)
strurl=url
strTmp = GetHTTPPage(trim(strurl))
MyTextFile.WriteLine(strTmp)
MytextFile.Close
response.write "生成"&filename&"成功<br>"
Set MyFileObject=nothing
End function
Function getHTTPPage(url)
On Error Resume Next
dim http
set http=Server.createobject("Microsoft.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
set http=nothing
If Err.number<>0 then
Response.Write "<p align='center'><font color='red'><b>服务器获取文件内容出错</b></font></p>"
Err.Clear
End If
End Function
Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
%>
#3
谢谢啊!我去试试
#4
学习中.............
#5
用 Rewrite.dll 重写
#6
可以用重定向作映射
也可以写个asp来处理
如index.asp?a=1.html映射
成index.asp?id=1的结构。
也可以写个asp来处理
如index.asp?a=1.html映射
成index.asp?id=1的结构。
#7
动态参数不多的话就没必要转。搜索引擎只是不喜欢动态参数过多的网页。
#8
搜索
url redirect
可以用服务器代码,比较麻烦
用javascript,类似
用iframe
用meta tag
但对于你说的情况,最常用的应该是在.htaccess中定义redirect
wiki中的例子很好,其他还有很多
------------------
Using .htaccess for redirection
When using the Apache web server, directory-specific .htaccess files (as well as apache's main configuration files) can be used. For example, to redirect a single page:
Redirect /oldpage.html http://www.example.com/newpage.html [R=301,L]
The above format used to work until somewhere around version 2.2.14. In the Apache HTTP server version 2.2.14 it has been found[by whom?] (on three separate servers, not a big sample but better than one) that placing a line of the above format in an .htaccess file causes an Internal Server Error for the entire site. Instead you should use the format dictated by the Apache Foundation [6] such as:
Redirect permanent /oldpage.html http://www.example.com/newpage.html
Redirect 301 /oldpage.html http://www.example.com/newpage.html
To change domain names using example.com/.htaccess or within a <Directory> section in an Apache config file:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^([^.:]+\.)*oldwebsite\.com\.?(:[0-9]*)?$ [NC]
RewriteRule ^(.*)$ http://www.preferredwebsite.net/$1 [R=301,L]
Use of .htaccess for this purpose usually does not require administrative permissions. However, .htaccess can be disabled by your host, and so may not work (or continue to work) if they do so.
In addition, some server configurations may require the addition of the line:
Options +FollowSymLinks
ahead of the "RewriteEngine on" directive, in order to enable the mod_rewrite module.
When you have access to the main apache config files (such as httpd.conf), it is best to avoid the use of .htaccess files.
If the code is placed into an Apache config file and not within any <Directory> container, then the RewriteRule pattern must be changed to include a leading slash:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^([^.:]+\.)*oldwebsite\.com\.?(:[0-9]*)?$ [NC]
RewriteRule ^/(.*)$ http://www.preferredwebsite.net/$1 [R=301,L]
url redirect
可以用服务器代码,比较麻烦
用javascript,类似
用iframe
用meta tag
但对于你说的情况,最常用的应该是在.htaccess中定义redirect
wiki中的例子很好,其他还有很多
------------------
Using .htaccess for redirection
When using the Apache web server, directory-specific .htaccess files (as well as apache's main configuration files) can be used. For example, to redirect a single page:
Redirect /oldpage.html http://www.example.com/newpage.html [R=301,L]
The above format used to work until somewhere around version 2.2.14. In the Apache HTTP server version 2.2.14 it has been found[by whom?] (on three separate servers, not a big sample but better than one) that placing a line of the above format in an .htaccess file causes an Internal Server Error for the entire site. Instead you should use the format dictated by the Apache Foundation [6] such as:
Redirect permanent /oldpage.html http://www.example.com/newpage.html
Redirect 301 /oldpage.html http://www.example.com/newpage.html
To change domain names using example.com/.htaccess or within a <Directory> section in an Apache config file:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^([^.:]+\.)*oldwebsite\.com\.?(:[0-9]*)?$ [NC]
RewriteRule ^(.*)$ http://www.preferredwebsite.net/$1 [R=301,L]
Use of .htaccess for this purpose usually does not require administrative permissions. However, .htaccess can be disabled by your host, and so may not work (or continue to work) if they do so.
In addition, some server configurations may require the addition of the line:
Options +FollowSymLinks
ahead of the "RewriteEngine on" directive, in order to enable the mod_rewrite module.
When you have access to the main apache config files (such as httpd.conf), it is best to avoid the use of .htaccess files.
If the code is placed into an Apache config file and not within any <Directory> container, then the RewriteRule pattern must be changed to include a leading slash:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^([^.:]+\.)*oldwebsite\.com\.?(:[0-9]*)?$ [NC]
RewriteRule ^/(.*)$ http://www.preferredwebsite.net/$1 [R=301,L]
#9
我要转换成静态页面是因为每个页面要设置不同的关键字,使搜索排名靠前~~~
#10
aspwebchh,我想问下,你那个代码是另外建一个网页还是,嵌到哪个网页啊?
#11
生成真实静态页或者用伪静态,或者用CMS,CMS里生成静态页的功能很好
#12
最好别费这个事,现在的搜索引擎智能程度很高,不是你设了什么关键字它就信的!再说,META关键字的权重几乎可以忽略。
#13
学习一下!
#14
如果不是虛擬主機,下載個iisapirewrite吧
#15
学习一下。。。收下慢慢研究
#16
我现在也是遇到这方面问题 http://www.chpxchina.net/newshow.asp?id=72 头疼啊
#17
我的网站也是这样的 http://www.wifi169.net 请高手指点,如果不好改,先从哪方面学起了?
#18
我的网站也是asp的 、想转呢 、但是不会 、又怕转完之后很多功能该实现不了了 、
真是麻烦 、asp的还不善于优化 、
真是麻烦 、asp的还不善于优化 、
#1
什么意思 你是指生成静态页面吗?
#2
<%
Set Rs=Server.CreateObject("Adodb.Recordset")
StrSQL="select * from WebInfo"
Rs.Open StrSQL,DbConn,1,1
If Rs.EOF Then
Else
path5="../html/" '这个为生成后文件路径
Do While Not rs.eof
filename=Replace(Replace(Replace(rs("Add_Date"),":",""),"-","")," ","")&".html" '这个为生成后的文件名
url="http://localhost/default/Web/Info_Body.asp?ID="&Rs("ID") '这个为动态页面地址,必须是http://****.asp格式的
StrSQL="Update WebInfo Set Html_URL='"&filename&"' Where ID="&Rs("ID")
DbConn.Execute StrSQL
Call createhtml(url,filename,path5)
rs.movenext
loop
End If
rs.close
Set rs=Nothing
Set conn=nothing
%>
<%
'功能:读取数据库内容,生成静态页面
'来自:www.aspprogram.cn
'作者:wangsdong
'参数说明:
' url是动态页面的地址,必须是http://*****/**.asp格式
' filename为生成后的文件名
' path为存储生成后文件的文件夹名
'备注:支持原创程序,请保留此信息,谢谢
Function createhtml(url,filename,path)
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
path1=server.mappath(path)&"\"&filename
Set MyTextFile=MyFileObject.CreateTextFile(path1)
strurl=url
strTmp = GetHTTPPage(trim(strurl))
MyTextFile.WriteLine(strTmp)
MytextFile.Close
response.write "生成"&filename&"成功<br>"
Set MyFileObject=nothing
End function
Function getHTTPPage(url)
On Error Resume Next
dim http
set http=Server.createobject("Microsoft.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
set http=nothing
If Err.number<>0 then
Response.Write "<p align='center'><font color='red'><b>服务器获取文件内容出错</b></font></p>"
Err.Clear
End If
End Function
Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
%>
#3
谢谢啊!我去试试
#4
学习中.............
#5
用 Rewrite.dll 重写
#6
可以用重定向作映射
也可以写个asp来处理
如index.asp?a=1.html映射
成index.asp?id=1的结构。
也可以写个asp来处理
如index.asp?a=1.html映射
成index.asp?id=1的结构。
#7
动态参数不多的话就没必要转。搜索引擎只是不喜欢动态参数过多的网页。
#8
搜索
url redirect
可以用服务器代码,比较麻烦
用javascript,类似
用iframe
用meta tag
但对于你说的情况,最常用的应该是在.htaccess中定义redirect
wiki中的例子很好,其他还有很多
------------------
Using .htaccess for redirection
When using the Apache web server, directory-specific .htaccess files (as well as apache's main configuration files) can be used. For example, to redirect a single page:
Redirect /oldpage.html http://www.example.com/newpage.html [R=301,L]
The above format used to work until somewhere around version 2.2.14. In the Apache HTTP server version 2.2.14 it has been found[by whom?] (on three separate servers, not a big sample but better than one) that placing a line of the above format in an .htaccess file causes an Internal Server Error for the entire site. Instead you should use the format dictated by the Apache Foundation [6] such as:
Redirect permanent /oldpage.html http://www.example.com/newpage.html
Redirect 301 /oldpage.html http://www.example.com/newpage.html
To change domain names using example.com/.htaccess or within a <Directory> section in an Apache config file:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^([^.:]+\.)*oldwebsite\.com\.?(:[0-9]*)?$ [NC]
RewriteRule ^(.*)$ http://www.preferredwebsite.net/$1 [R=301,L]
Use of .htaccess for this purpose usually does not require administrative permissions. However, .htaccess can be disabled by your host, and so may not work (or continue to work) if they do so.
In addition, some server configurations may require the addition of the line:
Options +FollowSymLinks
ahead of the "RewriteEngine on" directive, in order to enable the mod_rewrite module.
When you have access to the main apache config files (such as httpd.conf), it is best to avoid the use of .htaccess files.
If the code is placed into an Apache config file and not within any <Directory> container, then the RewriteRule pattern must be changed to include a leading slash:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^([^.:]+\.)*oldwebsite\.com\.?(:[0-9]*)?$ [NC]
RewriteRule ^/(.*)$ http://www.preferredwebsite.net/$1 [R=301,L]
url redirect
可以用服务器代码,比较麻烦
用javascript,类似
用iframe
用meta tag
但对于你说的情况,最常用的应该是在.htaccess中定义redirect
wiki中的例子很好,其他还有很多
------------------
Using .htaccess for redirection
When using the Apache web server, directory-specific .htaccess files (as well as apache's main configuration files) can be used. For example, to redirect a single page:
Redirect /oldpage.html http://www.example.com/newpage.html [R=301,L]
The above format used to work until somewhere around version 2.2.14. In the Apache HTTP server version 2.2.14 it has been found[by whom?] (on three separate servers, not a big sample but better than one) that placing a line of the above format in an .htaccess file causes an Internal Server Error for the entire site. Instead you should use the format dictated by the Apache Foundation [6] such as:
Redirect permanent /oldpage.html http://www.example.com/newpage.html
Redirect 301 /oldpage.html http://www.example.com/newpage.html
To change domain names using example.com/.htaccess or within a <Directory> section in an Apache config file:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^([^.:]+\.)*oldwebsite\.com\.?(:[0-9]*)?$ [NC]
RewriteRule ^(.*)$ http://www.preferredwebsite.net/$1 [R=301,L]
Use of .htaccess for this purpose usually does not require administrative permissions. However, .htaccess can be disabled by your host, and so may not work (or continue to work) if they do so.
In addition, some server configurations may require the addition of the line:
Options +FollowSymLinks
ahead of the "RewriteEngine on" directive, in order to enable the mod_rewrite module.
When you have access to the main apache config files (such as httpd.conf), it is best to avoid the use of .htaccess files.
If the code is placed into an Apache config file and not within any <Directory> container, then the RewriteRule pattern must be changed to include a leading slash:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^([^.:]+\.)*oldwebsite\.com\.?(:[0-9]*)?$ [NC]
RewriteRule ^/(.*)$ http://www.preferredwebsite.net/$1 [R=301,L]
#9
我要转换成静态页面是因为每个页面要设置不同的关键字,使搜索排名靠前~~~
#10
aspwebchh,我想问下,你那个代码是另外建一个网页还是,嵌到哪个网页啊?
#11
生成真实静态页或者用伪静态,或者用CMS,CMS里生成静态页的功能很好
#12
最好别费这个事,现在的搜索引擎智能程度很高,不是你设了什么关键字它就信的!再说,META关键字的权重几乎可以忽略。
#13
学习一下!
#14
如果不是虛擬主機,下載個iisapirewrite吧
#15
学习一下。。。收下慢慢研究
#16
我现在也是遇到这方面问题 http://www.chpxchina.net/newshow.asp?id=72 头疼啊
#17
我的网站也是这样的 http://www.wifi169.net 请高手指点,如果不好改,先从哪方面学起了?
#18
我的网站也是asp的 、想转呢 、但是不会 、又怕转完之后很多功能该实现不了了 、
真是麻烦 、asp的还不善于优化 、
真是麻烦 、asp的还不善于优化 、