Just when I think I am getting good at perl I get stumped again. I have found little on mod_rewrite here and I figure I am not the first to use mod_rewrite with perl for hiding the cgi and I wont be the last. So this is kinda off topic but I feel is relevant.

Thus I ask for your help as best as possible. If the behavior from the mod_rewrite is what I should expect from the third example ( earthlink ) please tell me so. I am hoping that it's just earthlink being lame ( and my employers instance on using them ) and that the Panix account is an example of what mod-rewrite is supposed to do.

We are creating dynamic websites that create ica files that enable citrix connections to our client schools as well as generating instructional websites that allow them to install the client.

My previous version ( example 1 ) we created a dummy directory and put a redirect that points to a cgi script. The disadvantage of this is that the children get confused and some of the spam blocking software at the school will block redirects (which is not under our control) in addition the ica file does not download correctly as a cgi script under netscape and thus many of the students cannot get on. In addtion dynamically generating directories to do this is messy and is not an elegant solution.

example 1 http://www.classlink2000.com/sites/bethpage

My solution was to use mod_rewrite and move our site to earthlinks Atlanta platform which they said would do such a thing after testing my idea was viable on a server equipped with the module. This works fine on Panix and the end user never knows its dynamic.

Example 2 http://www.panix.com/~hamilton/DEVELOPMENT/DBSITES/bethpage
NOTE Example only has the main page and ICA working

On the earthlink server I tested my scripts and am getting odd results. I worked on getting any scripts to work with the code but it seems the REQUEST_URI is set to the redirected URI after the mod rewrite is processed. So I then tested pushing the needed arguments using $1 and $2 with this rewrite ( bottom of post ) And achieved the desired rewrite but the url bar on the top of IE shows: http://w0105637.w1.net/DB_STEALTH/env_test.cgi?a=bethpage&b=index defeating the entire purpose of this exercise. This is not present on my non-earthlink example and I would appreciate any advice you could give me to getting the rewrite to be as it is in my working panix example.

example 3 http://w0105637.w1.net/DB_STEALTH/bethpage/index.html

turns into: http://w0105637.w1.net/DB_STEALTH/env_test.cgi?a=bethpage&b=index

RewriteRule ^([^/]+)/([^/]+).html$ http://w0105637.w1.net/DB_STEALTH/e +nv_test.cgi?A=$1&B=$2

Thank you for your help in advance


In reply to mod_rewrite and hiding perl by Angel

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.