Our teacher, the Rema, wrote in section 6: "Some say that this which was said, that a city of an individual is forbidden to be divided—this is specifically lengthwise, since both of them must walk to the public path that is within it. But widthwise, where these exit through this gate and those exit through that gate, and they have no right of passage over one another—they may establish an eruv in halves and make a rectification between them, as written in siman 363, that up to ten [cubits] a lechi or korah is effective, and for more than ten—a tzurath hapetach." Thus far his words. And this is the opinion of the Tur, and this matter is in the Gemara there. And the explanation of the matters is that this which we forbid to divide them—it is not only because it is like one courtyard, for because of that we would not forbid it. Rather, the primary reason is because, perforce, in the middle of the city there is a public path. And it is not a literal reshut harabim, for behold it is surrounded by a wall and has doors, for if not so—regardless, it is permitted to establish an eruv for part of it, as has been written. And consequently, when they divide lengthwise, this one on the side of the public path from the right and that one from the left—perforce, through this path of the public both of them will walk and they will forbid one another. And even though each one is a "foot that is permitted in its own place," and it does not forbid when not in its own place, like an inner courtyard regarding an outer one in siman 378, this is because the primary outer courtyard belongs to the residents of the outer one, and therefore the inner one does not forbid when it is permitted in its own place. But this public path, which is not designated for one of them—they forbid one another. (Magen Avraham, subsection 10) But widthwise—these will remove themselves from the public path on this side, and those will remove themselves from this side. But the Rif and the Rambam disagree on this, because in the Gemara there are two versions, and according to one version even widthwise it is forbidden, because it is impossible to remove oneself from the public path. Furthermore, they hold that the primary reason is because it is like one courtyard, and if so, there is no difference between lengthwise and widthwise. (And that which the Rema wrote "reshut harabim," his intention was a public path.)
וכתב רבינו הרמ"א בסעיף ו': "יש אומרים הא דעיר של יחיד אסור לחלק - היינו לאורכה, מאחר דשניהם צריכים לילך לרשות הרבים שבתוכה. אבל לרחבה, ואלו יוצאין בשער זה ואלו יוצאין בשער זה, ואין להם דריסת הרגל זה על זה - מערבין לחצאין ועושין תקון ביניהם, כמ"ש בסימן שס"ג, דעד עשרה מהני לחי או קורה, וביותר מי' - צורת הפתח" עכ"ל, וזהו דעת הטור, ודבר זה הוא בגמרא שם. וביאור הדברים, דזה שאנו אוסרים לחלקן - אינו רק מטעם דהוי כחצר אחד, דבשביל זה לא היינו אוסרין. אלא עיקר הטעם הוא - משום דבעל כורחם באמצע העיר יש דרך הרבים. ואינה רשות הרבים ממש, שהרי מוקף חומה ויש דלתות, דאם לא כן - בלאו הכי מותר לערב מקצתה, כמ"ש. וממילא דכשיתחלקו לאורכה זה מצד דרך הרבים מימין וזה משמאל - בעל כורחם שדרך רשות של רבים הזה ילכו שניהם ויאסרו זה על זה. ואף על גב דכל אחת הוי 'רגל המותרת במקומה', ואינה אוסרת שלא במקומה, כמו חצר פנימית על החיצונה בסימן שע"ח, זהו מפני שעיקר החצר החיצונה שייך לבני חיצונה, ולכן אין הפנימית אוסרת כשהיא מותרת במקומה. אבל דרך הרבים הלזו שאינה מיוחדת לאחד מהם - אוסרין זה על זה. (מג"א סק"י)אבל לרחבה - אלו יסתלקו מדרך הרבים שלכאן, ואלו יסתלקו מלכאן. אבל הרי"ף והרמב"ם חולקין בזה, משום דבגמרא יש שני לשונות, וללשון אחד גם לרחבה אסור, משום דאי אפשר להסתלק מדרך הרבים. ועוד, דסבירא ליה דעיקר הטעם הוא משום דהוי כחצר אחד, ואם כן אין נפקא מינה בין ארכה לרחבה. (וזה שכתב הרמ"א 'רשות הרבים' כונתו דרך הרבים)