Heat the salt, oil and onions in a medium sized pan on medium heat and cook for ten minutes. Then add the garlic and cook for a and cook briefly, do not let the garlic burn.
Add a few tablespoons of rice to the oil and saute the rice until brown, about 10 minutes. Stir it to gently, making sure it doesn't burn.
Add the rest of the rice and gently mix a few times to coat in oil. Then add the water, cinnamon, cardamom, and the green chili. Boil the rice uncovered on high or medium high until nearly all (95%) of the water is absorbed or evaporated
At this point test the rice and see if the rice is cooked through. It should be almost completely cooked but slightly hard inside.
Then lower the heat to low/warm and cover the rice. Let the rice steam for about 10 minutes or until you are ready to serve the rice. (If you find the rice is already completely cooked after boiling it, then skip the steaming part and just let all the water evaporate)