In UW IMAP a folder is either a mailbox or a directory for mailboxes, not both.
This is currently not fully supported in SquirrelMail, and the following has been found to give the most sane behaviour:
- Select uw as your server type
- Change default folder prefix if needed
- Don't move folders into Trash
There's still some quirks, but the above helps avoid some of it.