|
404 Trick for Web Promotion.
search engine's point of view. It is the biggest benefit to have well named pages. Most search engines, like Alta Vista and Yahoo.For example: Main Category: http://www.cambodia%2dtourism.org/index.asp?cat=26 - www.cambodia-tourism.org/index.asp?cat=26 is not memorable as Main Category: http://www.cambodia%2dtourism.org/Hospitality_Catering - www.cambodia-tourism.org/Hospitality_Catering Sub Category: wwww.cambodia-tourism.org/Hospitality_Catering/Beverage ...etc
My directory system in table category in MsAccess:
CategoryID | CategoryTitle | ParentCategoryID | Description | Pagename 26 Hospitality & Catering 0 Hospitality_Catering 34 Berverage 26 Hospitality_Catering/Beverage
As see in index.asp :
<a href="index.asp?cat=<%=CategoryID%>"><%=CategoryTitle%></a>
But now I change it. Instead of passing the Category id with querystring, I need to get the corresponding PageName and redirect to that page. Such as:
<a href="<%=PageName%>"><%=CategoryTitle%></a>
It will now redirect to: Category: http://www.cambodia%2dtourism.org/Hospitality_Catering - www.cambodia-tourism.org/Hospitality_Catering
Now I need to create the 404.asp page to handle all 404 page not found errors.
404.asp <% ' Getting page name dim PageName PageName = Request.ServerVariables("QUERY_STRING") %> <% ' Category id dim ID set obj = Server.CreateObject("ADODB.RecordSet") obj.Open "select CategoryID from TbleCategory where PageName = '"&PageName&"' ", DBCon if not obj.EOF then ID = obj.Fields("CategoryID")%>
<% 'Redirect ot Original Page transferURL = "index.asp?cat=" + CStr(CategoryID) Server.execute(transferURL) %>
<% Else Error.asp End if %>
I got some problem:
ADODB.Recordset (0x800A0BB9) Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. /www.cambodia-tourism.ws/404.asp, line 10
Can anyone resolve with this problem?.
|