Solved

Custom 404 and 301's in ASP

Posted on 2009-07-06
3
574 Views
Last Modified: 2012-08-13
I have a site that we are redeveloping that has to stay on the current host/environment. We do not have access to creating any type of redirection from .htm or .html files to any other type of files. However, we can create a custom 404 page.

The only server side scripting available is classic ASP (VBScript).

What I would like to do is have the custom 404 page get the URL that was originally requested and then do a 301 redirect to the new page.

Can someone tell me how to get the url that was originally requested in VBScript?
0
Comment
Question by:Hube02
  • 2
3 Comments
 
LVL 32

Accepted Solution

by:
shalomc earned 500 total points
ID: 24792175
try this code.
the second line filters out the "404;" string.
URLstring = Request.ServerVariables("HTTP_URL")

URLstring = Right(URLstring , (Len(URLstring ) - (Instr(URLstring , chr(59)))))

Open in new window

0
 
LVL 18

Author Comment

by:Hube02
ID: 24803207
I've been put on another project temporarily and it may be a few a bit before I get back to this.
0
 
LVL 32

Expert Comment

by:shalomc
ID: 24803587
take your time, just remember to come back :)
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Read about why website design really matters in today's demanding market.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now