apswater
VP-CART Super User
 
444 Posts |
Posted - May 12 2018 : 12:59:47
|
For seo it is a good idea to have the title of your pages listed in the URL. version 8 does this but not always. When google and other search engines scan your page, they eliminate query strings in the url to save space. In our case, the title=tags get removed because the pages load without them. If you look at your google listing (Site:YourURL.com on google) you will see something like shopexd.asp?id=20 and nothing else. You want google to keep the title tag and use it for ranking of keywords.
My solution was so make a file something like algorithms.asp and put an include into the top of shop$db.asp. Just below the <%response.buffer=true%>.
eg. <!#include file="Algorithms.asp"> (not the real name on my site)
I placed this code (among many others) into my file to permanently redirect (301) when the titles are eliminated or don''t match the actual page titles.
Comments and other tips welcome. Cam you have my permission to use any of the codes or ideas I post as they are public domain.
Replace <% " with <% tickmark (the forum changed it when you post.)
<% ''redirect shopdisplaycategories with 301 if url cat desc is incorrect or missing---------------------------------------------------
if request.servervariables("script_name")="/shopdisplaycategories.asp" AND request.querystring("id") <> "" then
dim oconnredir,mysqlredir,rsredir,correctCat
Set oConnRedir = Server.CreateObject("ADODB.Connection") oConnRedir.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=YourDatabasePath/Yourdatabase" mysqlRedir = "* FROM categories WHERE categoryid=" & request.querystring("id")
set rsRedir=oConnRedir.Execute(mysqlRedir)
correctCat=server.urlencode(rsredir("catdescription"))
oconnRedir.close set rsRedir=Nothing
if server.urlencode(request.querystring("cat"))<>correctCat then
Response.Status="301 Moved Permanently" Response.AddHeader "Location", "https://" & request.servervariables("server_name") & "/shopdisplaycategories.asp?id=" & Request.QueryString("id") & "&cat=" & correctCat response.end
end if end if
''---------------------------------------------------------------------------------------------------------------------- %>
<% ''redirect shopdisplayproducts with 301 if url cat desc is incorrect or missing-----------------------------------------------------------
if request.servervariables("script_name")="/shopdisplayproducts.asp" AND request.querystring("id") <> "" then
dim oconnredirProd,mysqlredirProd,rsredirProd,correctCatProd
Set oConnRedirProd = Server.CreateObject("ADODB.Connection") oConnRedirProd.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=YourDatabasePath/Yourdatabase" mysqlRedirProd = "* FROM categories WHERE categoryid=" & request.querystring("id")
set rsRedirProd=oConnRedirProd.Execute(mysqlRedirProd)
correctCatProd=server.urlencode(rsredirProd("catdescription"))
oconnRedirProd.close set rsRedirProd=Nothing
if server.urlencode(request.querystring("cat"))<>correctCatProd then
Response.Status="301 Moved Permanently" Response.AddHeader "Location", "https://" & request.servervariables("server_name") & "/shopdisplayproducts.asp?id=" & Request.QueryString("id") & "&cat=" & correctCatProd response.end
end if end if
''----------------------------------------------------------------------------------------------------------------------
%>
<% ''redirect shopexd.asp with 301 if url cat desc is incorrect or missing-----------------------------------------------------------
if request.servervariables("script_name")="/shopexd.asp" AND request.querystring("id") <> "" then
dim oconnredirProdexd,mysqlredirProdexd,rsredirProdexd,correctCatProdexd
Set oConnRedirProdexd = Server.CreateObject("ADODB.Connection") oConnRedirProdexd.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=YourDatabasePath/Yourdatabase" mysqlRedirProdexd = "* FROM products WHERE catalogid=" & request.querystring("id")
set rsRedirProdexd=oConnRedirProdexd.Execute(mysqlRedirProdexd)
correctCatProdexd=server.urlencode(rsredirProdexd("cname"))
oconnRedirProdexd.close set rsRedirProdexd=Nothing
if server.urlencode(request.querystring("title"))<>correctCatProdexd then
%> <%=server.urlencode(request.querystring("title"))%><br /> <%=correctCatProdexd%> <% Response.Status="301 Moved Permanently" Response.AddHeader "Location", "https://" & request.servervariables("server_name") & "/shopexd.asp?id=" & Request.QueryString("id") & "&title=" & correctCatProdexd response.end
end if end if
''----------------------------------------------------------------------------------------------------------------------
%>
|
Edited by - apswater on May 12 2018 14:37:36 |
|