Welcome, Guest ( Customer Panel | Login )




 All Forums
 VPCart Forum
 VP-Cart 8.0 Hint''s and Tips
 A mod Cam Might want to make permanent
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

apswater
VP-CART Super User

443 Posts

Posted - May 12 2018 :  12:59:47  Show Profile  Visit apswater's Homepage  Reply with Quote
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

swampthink
VP-CART New User

67 Posts

Posted - May 25 2018 :  11:28:17  Show Profile  Reply with Quote
that''s really nice tutorial and very appreciate. one question, it will react when we fill the Meta Title in the product setup page? are they related?

Thanks.
Go to Top of Page

apswater
VP-CART Super User

443 Posts

Posted - May 27 2018 :  22:23:42  Show Profile  Visit apswater's Homepage  Reply with Quote
I am not sure, you would have to check. I am working off an old imported database and didn''t use any of the seo stuff built in. All it does is look at the query string and adjust it to the page title for what type of page it is.

Edited by - apswater on May 27 2018 22:24:40
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000
0 Item(s)
$0.00