סימן יא סעיף א
מִצְוַת עֲשֵׂה לִקְבֹּעַ מְזוּזָה בְּכָל פֶּתַח. וַאֲפִלּוּ יֵשׁ לוֹ כַּמָּה חֲדָרִים וּלְכָל חֶדֶר כַּמָּה פְתָחִים הָעֲשׂוּיִים לִכְנִיסָה וִיצִיאָה, אַף עַל פִּי שֶׁהוּא רָגִיל רַק בְּאֶחָד מֵהֶם, מִכָּל מָקוֹם כֻּלָּם חַיָּבִים בִּמְזוּזָה. וַאֲפִלּוּ אִם נִתְמַעֲטוּ הַדִּיּוּרִים וְאֵינוֹ צָרִיךְ עַתָּה רַק לְפֶתַח אֶחָד, מִכָּל מָקוֹם כֻּלָּם חַיָּבִים. אַךְ אִם יֵשׁ אֵיזֶה פֶתַח שֶׁאֵינוֹ עָשׂוּי אֶלָּא לְהַכְנִיס דֶּרֶךְ שָׁם אֵיזֶה מַשָּׂא לִפְרָקִים וְיֵשׁ שָׁם פֶּתַח אַחֵר לִכְנִיסָה וִיצִיאָה, אֲזַי הַפֶּתַח הֶעָשׂוּי רַק לְהַכְנִיס מַשָּׂאוֹת, פָּטוּר (יו"ד סִימָן רפה רפו).
According to Rambam, a house must have these ten conditions for it to require a mezuzah: It must be at least six square feet, it must have two door-posts, a lintel, a ceiling, doors, an opening with a height of at least ten handbreadths, it must be used for secular purposes only, it must be used as a dwelling for people, it must be for dignified usage and it must be a permanent dwelling.
It is a positive commandment to affix a mezuzah on every doorway. Even if you have several rooms and each room has several entrances that are made for entry and exit, even though you are accustomed to use only one of these doorways, nevertheless, all of the doorways must have a mezuzah. [Also] even if the number of dwellers has diminished and you (the present dweller) now require only one doorway, nevertheless, all the doorways must have a mezuzah. However, if there is a particular doorway which is designated only as a place of entry for periodic deliveries and there is also an additional doorway which is used for both entry and exit, then the doorway which is used solely for delivery is exempt.
תנא דבי אליהו כל השונה הלכות בכל יום מובטח לו שהוא בן העולם הבא שנאמר הליכות עולם לו אל תקרי הליכות אלא הלכות (נדה ע"ג.)