http://www.ford.com/page.asp?model=explorer&year=1999A more presentable way of rewriting the URL might be:
http://www.ford.com/explorer/1999/It used to be that search engines would not index pages with querystrings (the information after the .asp? in the URL). These days this is not the case and most search engines do index these types of pages. However, it has been suggested that major search engines might not be able to use more than three querystring parameters.
strQuery = Request.ServerVariables("QUERY_STRING")You need to modify it a little. Change all of the page.asp and page2.asp to your own page names and add more of these lines if necessary. And add a custom error message after the Else line so that normal errors are still display when needed.
strPage = Mid(strQuery, InStrRev(strQuery, "/") + 1)
' Change page.asp and page2.asp and add duplicate lines for
' each page you want redirection
If strPage = "page.asp" Then
ElseIf strPage = "page2.asp" Then
'Put your normal error page here
Function RequestQS(strParam)Then in your scripts, instead of using the usual request/request.querystring/etc to retrieve your paramaters, use RequestQS(param-name).
strQuery = Request.ServerVariables("QUERY_STRING")
lngStart = InStr(strQuery,"/" & strParam & "/")
RequestQS = ""
If lngStart > 0 Then
lngStart = lngStart + Len("/" & strParam & "/")
lngEnd = InStr(lngStart + 0, strQuery, "/")
If lngEnd > 0 Then
RequestQS = Mid(strQuery, lngStart, lngEnd - lngStart)
http://www.mydomain.com/param1name/param1value/param2name/param2value/page.aspYou can then request the values of param1name, param2name etc by using RequestQS. (NB. You can include as many parameters as you need.)
http://www.ford.com/page.asp?model=explorer&year=1999A more presentable way of rewriting the URL using subdomains might be:
http://explorer.1999.ford.com/page.aspThis, of course, would depend on whether your hosting company allowed wildcard subdomains.
strServer = lcase(Request.ServerVariables("SERVER_NAME"))You need to add (or include) this to the beginning of each script that you want to use the subdomain(s) as parameters. Make sure you change mydomain.com to your own domain name (don't include any http:// or www.) and duplicate the line for any additional domain names that might also be used.
' Change mydomain.com to your domain name and duplicate
' this line for additional domain names
strServer = Replace(strServer, "mydomain.com", "")
If strServer = "" Then strServer = "."
strParams = Split(strServer, ".")
If intParam > UBound(strParams) Then
RequestSD = ""
RequestSD = strParams(intParam)
by John Avis | February 20, 2019
I was recently doing some work on a website which has a mixture of older Classic ASP pages and ASP.NET Web Forms pages and ran into problems with custom error pages.
by John Avis | March 21, 2017
I recently needed to change a client's website to send emails using Amazon SES and encountered a few issues.
by John Avis | June 8, 2016
Although probably no one cares about Classic ASP, except those who still need to support it, I was refreshing my memory today on how to use classes in Classic ASP and found a couple of options for simulating constructors with parameters.