If you are trying to prevent a 404 of a coldFusion page (e.g. /index2.cfm) where the cfm template doesn't exists you can use onMissingTemplate()
in your application.cfc
If the template that causes the 404 isn't something handled by CF (i.e .htm,.html) then you will have to catch it in the webserver using a custom 404 page or possibly a url rewite