Canned foods need to kept cool, dark, and dry to remain viable for as long as possible. Light will destroy nutrients in home-canned food, heat degrades quality and nutrients, and damp can rust lids of home-canned foods as well as tinned foods.
Home dehydrated foods require much the same, and are best kept in containers that are air-tight.
Salt just needs to be kept dry, sugar the same (neither go bad but can be ruined by damp).
White rice needs cool and dry like most dry goods but brown rice will go rancid fairly quickly unless you can keep it cool/refrigerated (but totally dry) or frozen (again, totally dry). If you want to store rice long-term, choose white rice and seal in in mylar bags inside sealed buckets with O2 absorbers.
For the following bit, YMMV and this is just my personal opinion/what my family believes and does: flour doesn't keep, no point in even buying pre-milled flour as most that is available is either dead (white flour) and "enriched" with vitamins and minerals that don't necessarily occur naturally in wheat, or rancid (whole wheat flour) which isn't usually actually "whole wheat" but is rather white flour with germ and bran added back along with the "enriching" nutrients. Best to buy actual wheat and other grains and grind your own flour on an as-needed basis.
