Rabbits will usually select a designated area within their cages for going to the bathroom. This is usually one corner of the cage etc. When you let them roam around on the carpet, they will go anywhere they please.
Here is what I did for my bunnies. I got them a small litter pan (so not to take up much of their cages) and used cat litter in it (scoop away is my favorite) that clumps but is not dusty (tidy cats is awful). I would place my bunny in the litter every so often, and he started to urinate in the litter pan as his designated place (much like training a cat). When I would let the rabbit loose on the floor, I would make the litter pan available to him while he was out. He still had accidents now and then, but they were greatly reduced. Be sure to place your bunny in the litter pan while he is roaming the floor frequently (and keep the litter pan in the same area, so that he will recognize that it is his "one" area to go in) and you will have him trained in no time.
I have had over 8 bunnies in my lifetime, and at least 5 of them were litter trained. It will make your life a lot less stinky, I promise.
**Note, I couldn't train my bunnies to poo anywhere specific though. They just kind of go wherever.