Gyms in Philadelphia will be allowed to reopen Monday, Public Health Commissioner Thomas Farley said Thursday.

Farley said gyms will have to follow strict social distancing rules if they open next week. Everyone in the gym must wear masks and be six feet away from each other, and classes must have fewer than 10 participants.

Gyms have been closed in Philadelphia since March under Mayor Jim Kenney’s executive orders to control the spread of the coronavirus. Elsewhere in the state, gyms are already allowed to operate.

Farley warned that, if case counts rise in the city, gyms may be ordered to close again, possibly within a few weeks.

» READ MORE: How to protect yourself against the coronavirus as gyms reopen

The city will conduct unannounced inspections of gyms to ensure the facilities are following safety rules. Gyms that violate rules or that are found to be related to newly confirmed coronavirus cases will be shut down.

Farley encouraged gyms to hold outdoor classes when possible, and instructed Philadelphians who do not or cannot wear masks while exercising to avoid indoor gyms.

Under the restrictive measures Gov. Tom Wolf implemented Wednesday, gyms and fitness centers statewide are allowed to continue indoor operations, but they are directed to “prioritize” outdoor fitness activities.

» READ MORE: Sweat and socially distance at these outdoor fitness classes in Philly, the suburbs, and New Jersey