In my experience, a rewrite is almost always the wrong course of action.  The best course of action is to just quit piling more and more unmaintainable hacks on top of it.  And pay down your technical debt.  Every time you find yourself thinking "boy, it sure would be easier if I could do it this way", stop wishing and <i>make it happen</i>.<p>Sure, it's going to take you longer to get stuff done in the short term.  But in the long run, you'll appreciate it.