In index.cgi: ... my $q = new CGI; my $path = $q->url(-relative => 1, -path=>1); # $path = "index.cgi/loadPage/10"