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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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? |
|
|||
|
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? |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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 |