I'm confused why you just interjected comments about the redirect script into a discussion about importing UBBCGI to UBB.threads...
I was talking about the redirection scripts that are included in the ubbclassic_6_7_import.zip. These redirection scripts are necessary to redirect any existing UBB.classic links to the new UBB.threads installation.
As mentioned previously, UBBCGI is not UBB.Classic; the two may have similar URL structure, but they are not the same. The re-director scripts shouldn't be used in this instance as it is not a UBB.Classic install, so existing URLs won't properly parse to their proper location for this users bookmarked/search engine links.
Removing the magic quotes runtime line also will not "just fix" the redirector scripts, I've attempted to modify it to work in a modern environment (PHP5.6 and PHP7+) for a vanilla UBB.Classic site to no avail; but in this instance it wouldn't matter as the OP is not even running UBB.Classic or UBB.threads.
Also, the redirector scripts were last touched by Ian Spence in the mid 2000s.
The OP is regarding upgrading UBBCGI to the current UBB.threads, and somehow we're now derailed discussing the redirect scripts for a product he isn't even running; please stay on topic.
The product paths are (UBB.threads7 was created to merge the two UBB downloadable products and has the majority of the features between the two products):
UBBCGI (End of Life pre 1998, Perl) -> UBB.Classic (End of Life in 2002, Perl) -> UBB.threads7 (Current, PHP)
WWWThreads (End of life 1998, PHP) -> UBB.threads6 (End of life/rebuild October 5th, 2006, PHP) -> UBB.threads7 (Current, PHP)
Note, I have been in the forest camping with a Scouting troop since the OP, so I haven't fully caught up with everything yet
If OP is indeed running UBB.Classic there is a specific upgrade path that should be followed:
Upgrading UBB.Classic to 6.7.x to ensure the importer can properly import the data
Upgrading UBB.Classic from 6.7.x to UBB.threads v7.2 (so that the Global Moderator permission addition in v7.3 does not assign the users as moderators and the moderators as GMs)
Upgrading UBB.threads 7.2 to UBB.threads Current