cgi and mod_rewrite

This is a discussion on cgi and mod_rewrite within the Apache Web Server forums, part of the Web Server and Related Forums category; Is there a way to use mod_rewrite to - test incoming uri for something like /cgi-bin/foo/bar.cgi - and ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-10-2007
cpayne.tcr@gmail.com
 
Posts: n/a
Default cgi and mod_rewrite

Is there a way to use mod_rewrite to
- test incoming uri for something like /cgi-bin/foo/bar.cgi
- and then remap it to a file like so foo/bar.php

I have tried this:
RewriteRule ^/cgi-bin/foo/bar\.cgi$ foo/bar.php [R,L,QSA]
but my rewrite log show this:
- (2) init rewrite engine with requested uri /cgi-bin/foo/bar.cgi
- (3) applying pattern '.*' to uri '/cgi-bin/foo/bar.cgi'
- (4) RewriteCond: input='GET' pattern='^TRACE' => not-matched
- (1) pass through /cgi-bin/foo/bar.cgi

Any thoughts?

  #2 (permalink)  
Old 01-10-2007
cpayne.tcr
 
Posts: n/a
Default Re: cgi and mod_rewrite

Come on folks, this is killing me...

cpayne.tcr@gmail.com wrote:
> Is there a way to use mod_rewrite to
> - test incoming uri for something like /cgi-bin/foo/bar.cgi
> - and then remap it to a file like so foo/bar.php
>
> I have tried this:
> RewriteRule ^/cgi-bin/foo/bar\.cgi$ foo/bar.php [R,L,QSA]
> but my rewrite log show this:
> - (2) init rewrite engine with requested uri /cgi-bin/foo/bar.cgi
> - (3) applying pattern '.*' to uri '/cgi-bin/foo/bar.cgi'
> - (4) RewriteCond: input='GET' pattern='^TRACE' => not-matched
> - (1) pass through /cgi-bin/foo/bar.cgi
>
> Any thoughts?


  #3 (permalink)  
Old 01-10-2007
Jim Hayter
 
Posts: n/a
Default Re: cgi and mod_rewrite

cpayne.tcr wrote:
> Come on folks, this is killing me...
>
> cpayne.tcr@gmail.com wrote:
>> Is there a way to use mod_rewrite to
>> - test incoming uri for something like /cgi-bin/foo/bar.cgi
>> - and then remap it to a file like so foo/bar.php
>>
>> I have tried this:
>> RewriteRule ^/cgi-bin/foo/bar\.cgi$ foo/bar.php [R,L,QSA]
>> but my rewrite log show this:
>> - (2) init rewrite engine with requested uri /cgi-bin/foo/bar.cgi
>> - (3) applying pattern '.*' to uri '/cgi-bin/foo/bar.cgi'
>> - (4) RewriteCond: input='GET' pattern='^TRACE' => not-matched
>> - (1) pass through /cgi-bin/foo/bar.cgi
>>
>> Any thoughts?

>


You show us a rewrite rule but your log file also shows a rewrite cond.
What is the totality of the rewrite directives being applied here?

It almost looks like there is an earlier set of rewrite directives
consisting of:
RewriteCond <is this NOT a TRACE request>
RewriteRule .* passthru anything that matches condition

The passthru will bypass any further rewrite rule processing.

Jim
  #4 (permalink)  
Old 01-11-2007
cpayne.tcr
 
Posts: n/a
Default Re: cgi and mod_rewrite

Jim,

Thank you for your reply.

I think I neglected to indicate that this is in an htaccess file in the
document root of my webserver.

There are two other conditions in this particular htaccess file: it
tests against the request NOT being an actual file or directory and
rewrites the base by adding a slash before the rewrite rule I wrote
below.

Is there somewhere else that a condition could be invoked that is
highjacking the process?

Thanks,

Charles

Jim Hayter wrote:
> cpayne.tcr wrote:
> > Come on folks, this is killing me...
> >
> > cpayne.tcr wrote:
> >> Is there a way to use mod_rewrite to
> >> - test incoming uri for something like /cgi-bin/foo/bar.cgi
> >> - and then remap it to a file like so foo/bar.php
> >>
> >> I have tried this:
> >> RewriteRule ^/cgi-bin/foo/bar\.cgi$ foo/bar.php [R,L,QSA]
> >> but my rewrite log show this:
> >> - (2) init rewrite engine with requested uri /cgi-bin/foo/bar.cgi
> >> - (3) applying pattern '.*' to uri '/cgi-bin/foo/bar.cgi'
> >> - (4) RewriteCond: input='GET' pattern='^TRACE' => not-matched
> >> - (1) pass through /cgi-bin/foo/bar.cgi
> >>
> >> Any thoughts?

> >

>
> You show us a rewrite rule but your log file also shows a rewrite cond.
> What is the totality of the rewrite directives being applied here?
>
> It almost looks like there is an earlier set of rewrite directives
> consisting of:
> RewriteCond <is this NOT a TRACE request>
> RewriteRule .* passthru anything that matches condition
>
> The passthru will bypass any further rewrite rule processing.
>
> Jim


  #5 (permalink)  
Old 01-11-2007
Jim Hayter
 
Posts: n/a
Default Re: cgi and mod_rewrite

cpayne.tcr wrote:
> Jim,
>
> Thank you for your reply.
>
> I think I neglected to indicate that this is in an htaccess file in the
> document root of my webserver.
>
> There are two other conditions in this particular htaccess file: it
> tests against the request NOT being an actual file or directory and
> rewrites the base by adding a slash before the rewrite rule I wrote
> below.
>
> Is there somewhere else that a condition could be invoked that is
> highjacking the process?
>


I don't use .htaccess as I control my httpd.conf files. Is it possible
that there are Rewrite conditions/rules in the main configuration file
that are interfering with what you want to do?

Do any of your existing rewrite rules set the L or PT flags?

Jim
  #6 (permalink)  
Old 01-12-2007
cpayne.tcr
 
Posts: n/a
Default Re: cgi and mod_rewrite



On Jan 11, 9:37 am, Jim Hayter <see.reply...@nowhere.invalid> wrote:
> cpayne.tcr wrote:
> > Jim,

>
> > Thank you for your reply.

>
> > I think I neglected to indicate that this is in an htaccess file in the
> > document root of my webserver.

>
> > There are two other conditions in this particular htaccess file: it
> > tests against the request NOT being an actual file or directory and
> > rewrites the base by adding a slash before the rewrite rule I wrote
> > below.

>
> > Is there somewhere else that a condition could be invoked that is
> > highjacking the process?I don't use .htaccess as I control my httpd.conf files. Is it possible

> that there are Rewrite conditions/rules in the main configuration file
> that are interfering with what you want to do?
>
> Do any of your existing rewrite rules set the L or PT flags?
>
> Jim


I think you are correct. I'm not sure how much control I will have
over the new server (I've been working on my local machine) so I will
look into controlling it through the .conf file.

Thanks again.

Charles

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:28 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0