rtrim() was not the right method to use. It would trim off the end of any controller name that matched any part of the end in the word 'Controller'. I updated this to a preg_match