Before swimming in a pool or the ocean, wet your hair with clean water. This can help reduce the absorption of chlorine or saltwater. After swimming, rinse your hair thoroughly and use a clarifying shampoo to remove any lingering chemicals.