How to detect browser and re-direct

I want to put some HTML code on my page that will detect the user who goes to my site's browser, and if it's a certain browser (like Internet Explorer or Mozilla Firefox), it will re-direct them to another page I have. How can I do this?

You either do this in your (a) web server's configuration, (b) web server script, or (c) in Javascript which you include or refer to from your HTML page. If it's Javascript, there's many many choices, and I suggest you search free code libraries for such code. Here's one exmple. Once you have the browser, you will do something like

 window.location="http://new.url/somewhere.else"

You can examine the HTTP "User-Agent" header that may carry information about the user's browser used. How to do depends on your server-side development platform (e.g. CGI/PHP/Java etc.) However, because that field can be easily forged, it is not necessarily accurate but that is mostly what you can do.

For redirects, there are mainly 2 ways: HTTP redirect and HTML-based (browser) redirect. With HTTP redirect the server-side generates a redirect (a "moved" HTTP response) that the browser responds to. The second way is to generate a meta tag in the HTML returned to browser, that the browser will do the redirect, but only after the original response is rendered completely. Again, how to do depends on your development platform.

The main difference is that HTML-based redirect will break the "back" button. If the user presses the back button after the redirect, the browser will run the redirect again and the end result is the user is not redirected.

You do not necessarily need to do this with programming. I think you can also implement some of these redirect schemes with certain Apache configuration directives. Dealing with this the Apache way is not my favourite, but that is up to you.