Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

CGI URL simple

by Anonymous Monk
on Feb 21, 2020 at 18:23 UTC ( #11113320=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:


I have a very naive question about CGI. I have a small CGI script that generates a basic HTML page. The script is called by a URL such as

Everything works fine. What I do not like is that in the URL bar I see this monster URL ( Is there any way to maybe reduce it to or something similar (of course without changing page)?

Replies are listed 'Best First'.
Re: CGI URL simple
by LanX (Archbishop) on Feb 21, 2020 at 18:35 UTC

      Thank you. This pointed me to the right direction. I simply rewrote the rule in .htaccess

        In case you aren't already aware aware that there are performance implications (which may be avoidable) from using .htaccess files:

        "You should avoid using .htaccess files completely if you have access to httpd main server config file. Using .htaccess files slows down your Apache http server. Any directive that you can include in a .htaccess file is better set in a Directory block, as it will have the same effect with better performance."

        "The first of these is performance. When AllowOverride is set to allow the use of .htaccess files, httpd will look in every directory for .htaccess files. Thus, permitting .htaccess files causes a performance hit, whether or not you actually even use them! Also, the .htaccess file is loaded every time a document is requested."

        "In the case of RewriteRule directives, in .htaccess context these regular expressions must be re-compiled with every request to the directory, whereas in main server configuration context they are compiled once and cached. Additionally, the rules themselves are more complicated, as one must work around the restrictions that come with per-directory context and mod_rewrite. Consult the Rewrite Guide for more detail on this subject."


Re: CGI URL simple
by k-mx (Sexton) on Feb 24, 2020 at 16:00 UTC
    CGI is not cool anymore. I'm sure, that you will like Mojolicious. Easy to use and construct whatever url you like with builtin routing

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://11113320]
Approved by haukex
Front-paged by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2020-04-08 05:24 GMT
Find Nodes?
    Voting Booth?
    The most amusing oxymoron is:

    Results (43 votes). Check out past polls.