How to redirect from a page on the main site to the relevant page on the mobile site when using a mobile

How to redirect from a page on the main site to the relevant page on the mobile site when using a mobile



Let's say you have a main site www.abc.com and a mobile site m.abc.com.

You may have issue, e.g. if a specific page is selected on a mobile (e.g. www.abc.com/shopexd.asp?id=xx) instead of redirecting the user to this specific product on the mobile site, the user is redirected to the home page m.abc.com.

To fix the above issue so that it will redirect from a page on the main site to the relevant page on the mobile site when using a mobile, please follow these steps below :

1. Open your VP-ASP template header file ( shoppage_header.htm ). This file usually located in the folder " templates/default-2cols/ " (if you are using 2 columns template) or " templates/default-3cols/ " (if you are using 3 columns template) using text editor such as notepad or wordpad.

2. Locate this code below :

</head>


3. Directly below it, please insert this new code :


<%
on error resume next
dim passto_mobile_url
passto_mobile_url = ""
select case lcase(GetSess("CurrentURl"))
case "shopexd.asp"
if trim(CatalogId) = "" then
end if
if err.number = 0 then
if trim(CatalogId) <> "" then
passto_mobile_url = "m."& request.ServerVariables("HTTP_HOST") &"/productdetail.mobile?id="& CatalogId &""
end if
end if
case "shopdisplaycategories.asp"
if trim(highercategoryid) = "" then
end if
if err.number = 0 then
if trim(highercategoryid) <> "" then
passto_mobile_url = "m."& request.ServerVariables("HTTP_HOST") &"/categoriesdisplay.mobile?id="& highercategoryid &""
end if
end if
case "shopdisplayproducts.asp"
if trim(CAT_ID) = "" then
end if
if err.number = 0 then
if trim(CAT_ID) <> "" then
passto_mobile_url = "m."& request.ServerVariables("HTTP_HOST") &"/productdisplay.mobile?id="& CAT_ID &""
if trim(CATEGORY) <> "" then
passto_mobile_url = passto_mobile_url & "&cat="& CATEGORY &""
end if
end if
end if
case "shopcontent.asp"
if trim(MessageType) = "" then
end if
if err.number = 0 then
if trim(MessageType) <> "" then
passto_mobile_url = "m."& request.ServerVariables("HTTP_HOST") &"/content.mobile?type="& MessageType &""
end if
end if
end select
on error goto 0
%>

4. Save the file and upload the header template file back to your site.


Times Viewed:
4969
Added By:
Wilson Keneshiro
Date Created:
9/26/2014
Last Updated:
1/9/2015