On October 15, two Appalachian Trail thru-hikers were escorted off a Frontier Airlines flight at Boston’s Logan airport. The duo (who asked not to be named) had just completed their northbound hike and said they stopped to shower and change into clean clothes before arriving at the airport. Nevertheless, shortly after boarding, they were approached by crew members, who said they would not be allowed to fly because at least one of them had what was deemed to be offensive body odor. The hikers were walked off the plane, provided with travel-size toiletry bags, and told they could try to fly again the next day.

Back in the terminal, the hikers posted a tongue-in-cheek photo on a Facebook page for hikers. “First taste of the real world,” they wrote. “Now we’re in Boston with no way to get home.”

This elicited all kinds of responses from fellow backpackers, ranging from outrage (“Total bullshit! They should have let you fly!”) to empathy for the other passengers (“I wouldn’t even let my husband ride home in my car after he finished his hike!”). And it included, perhaps not surprisingly, all kinds of advice, ranging from the obvious (“Did you try deodorant?”) to the downright dangerous (“Douse yourself in Febreze and rub hand sanitizer in your armpits!”).

I contacted both hikers, along with Frontier. The two backpackers and the airline both said there had been some extenuating circumstances that hadn’t been made clear in the viral Facebook post—namely, that the hikers were flying on buddy passes (standby tickets provided to airline employees), because one of the hiker’s relatives works for the company. A Frontier spokesperson explained that passengers flying on these nonrevenue-generating tickets are held to a higher standard for personal hygiene. But, like most airlines, Frontier also has a general policy concerning such matters.

“At Frontier Airlines we love the outdoors and welcome adventurers onboard our flights every day,” Zach Kramer, manager of corporate communications, said in an email. “The comfort of our customers while onboard is always top of mind and our team will work with passengers to ensure everyone has an enjoyable flying experience on Frontier, including addressing any hygiene-related concerns that may affect fellow flyers.”

Eventually, the two hikers contacted a friend in Boston, who drove them to a thrift store to buy new clothes and let them take another shower at her house. They managed to fly home the next day.

They are far from alone. Last year, a family of three was escorted off an American Airlines flight after passengers complained about what they called offensive body odor. The airline booked the family on another flight and gave them vouchers for meals and a hotel, though they told The Washington Post that the vouchers didn’t work and they weren’t allowed to retrieve their luggage. In 2016, a Nigerian woman and her children were removed from a United Airlines flight bound for San Francisco from Houston for similar reasons.

It’s obviously not for us to say whether any of these individuals smelled offensive when they boarded their respective flights. But if you’ve spent any time around long-distance backpackers or other endurance athletes, you know the funk is real. So how can you make sure you get home after your next big adventure? Here are a few tips to get you past more than security.

Read the Airline Policy Before You Fly

I reached out to several major airlines. Of those that responded to my inquiries, all have policies concerning personal hygiene. An American Airlines representative pointed me to the fine print on its tickets, which state that all passengers must “be respectful that your odor isn’t offensive (unless it’s caused by a disability or illness).” Delta stipulates that you can be removed if your “hygiene or odor creates an unreasonable risk of offense or annoyance to other passengers.” Ditto for Southwest and all members of the Lufthansa group. The former told me it handles each potential BO situation on a case-by-case basis. A rep from Lufthansa told me, “We rely on our crew to use fair, reasonable judgement in making such a decision. Our guests’ safety and comfort is of the utmost priority, and they are asked to make decisions that ensure both.”

Technically, none of these airlines have to rebook you or compensate you for your ticket, but most of the representatives I spoke with said they will make every attempt possible to get you on another flight—provided you smell better by then.

Don’t Assume You Can Skirt By on Trains or Buses

Amtrak also has a policy of refusing to carry passengers “whose personal hygiene makes them offensive.” Greyhound didn’t respond to several requests for information, but its website says the company is a “stickler” about not allowing unruly behavior. It’s not clear whether or not that includes the way a person smells, but the Huffington Post reports that a person was banned from municipal buses in Washington State because he smelled like pot smoke. Residents of Hawaii are a little more tolerant: the city of Honolulu permanently tabled a proposal to fine stinky bus riders there after residents objected to the language.

Know the Science

We have two major types of sweat glands in our bodies, says Dr. Marlyanne Pol-Rodriguez, a dermatologist and clinical assistant professor at the Stanford Medicine Outpatient Center. Eccrine glands, which are located near the surface of the skin, are pretty much everywhere on our bodies. They secrete a mixture of water, electrolytes, and salt, which is virtually odor-free. Apocrine glands, on the other hand, are located primarily in our armpits, chest, and genital region. These glands secrete a combination of sweat and oil, which feeds bacteria located on our bodies. When that bacteria breaks down thicker, richer sweat, it results in odor, says Pol-Rodriguez.

Be Proactive

According to Pol-Rodriguez, one way to prevent excessive body odor from accumulating is to use antibacterial soap when you shower at hiker hostels or motels. And while hikers are often loathe to carry any more weight than they have to, Pol-Ridriguez says it’s definitely worth it to stash a small pouch of baby wipes in your pack and use them often. The good news: because apocrine glands are so centrally located, you can really economize on where you wipe, and make that quarter-pound bag of baby wipes last for days.

Skip the Chemicals

Pol-Rodriguez is pretty wary of any body-odor-removal regimen that includes applying cleaners or high doses of hand sanitizer or cologne directly to your skin. “There’s just too much in them that might irritate the skin—especially if you have to sit for a long flight,” she says. If you think you need to go beyond soap and wipes, she recommends using superdiluted vinegar (as little as a tablespoon or two per cup of water) when you bathe.

Clothes and Gear Smell Worse Than You

It’s particularly hard to get odor out of clothes, says Pol-Rodriguez. She favors products like OxiClean for getting funk out of garments you really want to hang onto. If you or someone you know can ship you some clean clothes before you board a plane, that’s half the battle. Buying new or used ones is a good plan, too—just be sure to wash them first. Oftentimes companies will spray clothes with chemicals to stabilize colors and keep them looking new, she says. And clothes that have been sitting around a warehouse can be filled with dust mites, which can also cause skin irritation.