Rifaximin is an antibiotic. In hepatic encephalopathy, it works by killing the ammonia-producing bacteria thereby relieving symptoms such as agitation, confusion, and muscle problems. In infectious diarrhea, it works by stopping the growth of bacteria that cause diarrhea.