use the collapsed path in the run_cgi method (closes #19435)
merge 3.1 (#19435)