Response redirect ONLY if browser URI gives an 404 error
How does one redirect to an external URL in the response ONLY if the URI in the browser returns a 404?
ex) When you hit a page and the URL in the browser is "http://xyz.com/xyz". You ONLY want to redirect if
"http://xyz.com/xyz" returns a 404. What you do NOT want is if a image request "http://xyz.com/imagexyz" within the page
returns a 404 and the response event redirect the user.
1) request --> "http://xyz.com/xyz" // return 404
2) request --> "http://xyz.com/imagexyz" // return 404
3) response --> redirect to external URL
1) request --> "http://xyz.com/xyz" // return 200
2) request --> "http://xyz.com/imagexyz" // return 404
3) response --> NO redirect happens
Hopefully that made sense.
Thank you in advance.
Regards,
TRX