Here’s is one carpet cleaning solution I found online and that works for me. The recipe goes: two cups of baking soda, half a cup of cornstarch, four bay leaves, one tablespoon of whole cloves, one tablespoon of borax. Mix it all in a blender until you get an even consistency, then place the cleaning solution in a container, preferably one that lets you sprinkle the solution.
To use it, simply vacuum the area you want clean, add a heavy dose of the cleaning solution, then let it sit overnight. In the morning, vacuum the area once again. It should help with both the appearance and the smell of the carpet.
If that doesn’t help, again, your best bet is hiring a professional. You can check Bourne To Clean for professional carpet cleaners Dorset.