The fault report "doesn't work" is completely useless to describe what you expected, what actually happened, and how that differed from what you wanted.
Delete line 3 and line 5.
When on live site activate line 2 and line 4.
When on localhost comment out line 2 and line 4.
The (.*)_(.*) part of the patterns should be ([^_]+)_([^.]+) or similar.