http://qs321.pair.com?node_id=452942

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

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: perl hide by html....
by Zaxo (Archbishop) on May 01, 2005 at 02:15 UTC

    I'm not entirely clear about what you're asking for, but I think you want a request for a .htm page to transparently fire a cgi script which generates the page. You can set that up with Apache's mod_rewrite. In .htaccess put:

    RewriteEngine on RewriteBase /~quux/ RewriteRule ^page1\.htm$ a.cgi [T=application/x-httpd-cgi]
    (Adapted from the URL Rewriting Guide in the Apache manual.)

    I can see that you might be asking about something entirely different, maybe something about displaying a link. If so, please clarify.

    After Compline,
    Zaxo

Re: perl hide by html....
by tilly (Archbishop) on May 01, 2005 at 02:10 UTC
    Making dynamically generated pages look like regular URLS requires cooperation from your webserver. If you are using Apache, you can do it by installing and configuring mod_perl. Other webservers will require different solutions.

    You need control of the webserver that your site is running on to do what you want. If, for example, you are using a shared host, then you may be unable to get fine control over what your CGI links can look like.

      Actually, it's a lot easier than that. Yes, you can use URL rewriting, like with mod_rewrite in apache, or define alternate executable paths, like you would do for mod_perl, but there's actually a concept in CGI called PATH_INFO. It allows you to pass arguments without needing the question mark to deliniate a QUERY_STRING:

      http://server:port/path/script/PATH_INFO

      Of course, the problem is that most web server administrators go with the default CGI script location of 'cgi-bin', or 'cgi' or something similar, which would be a giveaway. The only real requirement is that you have access to define which files get executed. This control may have been delegated to .nsconfig or .htaccess files, depending on the setup.

      And of course, there's also the use of other dynamicly generated pages, other than CGI, such as by using SSI, ColdFusion, PHP, ASP, or any other text-preprocessor. Of course, once again, you will need to have that parsing configured on the webserver, but it's possible to either use only index pages, and refer to them as directories, so that the browser never sees the file extension, or to configure something like the old execute hack in Netscape web server. (if the file is marked as being executable, no matter its extension, it gets parsed or executed, or whatever you want).

        Of course, once again, you will need to have that parsing configured on the webserver, but it's possible to either use only index pages, and refer to them as directories, so that the browser never sees the file extension

        Wouldn't the index page need to be setup to be executable by file extension, though? Or do webservers usually have a configuration option to allow exection by filename rather than just extension?

Re: perl hide by html....
by Anonymous Monk on May 01, 2005 at 03:32 UTC
    Thanks for your replies. I know that i'm very confused :). I will try to explain the best i can. My site for this momment is just running in my localhost. I host my site in a apache server and i can't put my own server running(command line) but i think that i can made my server to be a webservice soo i didn't need to put it running(command line), my multi-cliente side could get access to it. If my thouth is wrong please tell me :). I use forms in send email for example, when i use forms everything ok. In otherhand my menus are like a.cgi?a=something_a , a.cgi?b=something_b ... this apears in status bar... i like to this doesn't happen. I coud make in java and put somethig apears in the status bar. But in the site http://www.ncc.up.pt/~mcc/AR/ i think that the server catch the urls like titty said,and than like Zaxo said "request for a .htm page to transparently fire a cgi script which generates the page" and this seems right too :). My head is splinnig :) :( Can i clarify something in your minds!!! Maybe. I wait for answer :)
      I will try to explain the best i can. My site for this momment is just running in my localhost. I host my site in a apache server and i can't put my own server running(command line) but i think that i can made my server to be a webservice soo i didn't need to put it running(command line), my multi-cliente side could get access to it. If my thouth is wrong please tell me :)
      You can find help about apache at apache.org.
      ...i like to this doesn't happen.
      Look for "server side includes" on apache.org, that's what you want.

      Another alternative, if you just want to prevent the CGI parameters showing up in the address bar, is using the POST method for your forms instead of GET.