I am creating a script that does the following:
-User types URL: whatever.com/directory
-User is redirected to 404.asp error page
-404.asp page checks to see if whatever/directory is setup to forward to a specified URL, if it is, it redirects them to the URL. If not they stay on the 404.asp page.
I've got this aspect working...Now, what I don't know how to do is strip out the URL so if a user types in whatever.com/directory -- (Html, asp, htm etc.. etc..) they will still be directed to the proper place.
In other words, I only need it to read what comes after the /whatever in the URL line. That way if people type /directory.html /directory.asp etc... It will ignore the .asp .html or even .serjkwerjkwe for that matter. I just need it to ignore anything typed after that point and send them to the proper URL.
I want to eliminate all user error but I don't want to have to enter each specic incorrect URL tag that they could type. I just want it to strip out the /directory and that's it.
This is the code I have so far:
<%
'Get the user-requested URL
requestedURL = Replace(Replace(Replace(Replace(Replace(Request.ServerVariables("QUERY_STRING"),"404;
http://www.visionforum.com",""), "/", ""), ".asp", ""), ".htm", ""), ".html", "")
If requestedURL = "doll" Then
Response.Redirect("/beautifulgirlhood/productinfo.asp?number=72564")
Else%>
Any ideas how to best do this?