One approach is to create 2 web sites.
One's your normal everyday site: http://www.example.com
The other is a copy of the everyday site, except you modify the CSS and make whatever other changes are needed to support your mobile users. By convention, you have your server folks set that up with the address http://m.example.com.
Now for the clever bit: in your main web site, you look at the browser string that accompanies every request. If that string looks like it belongs to a mobile device, you respond to the request with a 302 Redirect (or similar - there's a lot of different ways to do this).
If you need the specifics on how to look at the browser string or do the redirect using your particular tool set, you'd be best off posting a separate question (or two) on Stackoverflow instead of here.