Put on rubber gloves, a face mask and goggles if you think there’s a possibility that your carpet has mold or mildew. This is particularly true if you have water damage.
Pull up the carpeting all around the edges, and lift it up. You may need to remove some carpeting staples. Roll up the carpet, and lay it out in your driveway on a large plastic tarp.
Place a powerful spray nozzle over your hose, and blast the carpet with water. This will rinse out a lot of the dirt.
Flip the carpet over, and spray it again in the same way. Be sure to hit all areas of the carpet to remove as much dirt and debris as possible.
Mix together a few tablespoons of detergent in a bucket of warm water. The solution should be very sudsy.
Pour the cleaning solution over the damaged carpet. Get down with a scrub brush, and thoroughly scrub all stained areas. Flip the carpet over, and scrub that side, too.
Rinse the carpet with your hose on both sides.
Dump out the detergent solution, and fill the bucket with a water and bleach solution. Use 2 tbsp. of bleach for each gallon of water.
Rinse the carpet thoroughly with the bleach solution. Scrub any areas that still appear to be stained with your scrub brush. This is important if mold or mildew are a possibility.
Rinse the carpeting again on both sides, using your hose.
Get out your wet/dry vacuum, and use it on the carpet. Extract as much of the liquid as you possibly can. Either let the carpet dry in the sun, or take it inside with a dehumidifier running nearby, which helps pull the moisture from the carpet.