How to mod_rewrite user directories with a CGI?

This is a discussion on How to mod_rewrite user directories with a CGI? within the Linux Web Servers forums, part of the Web Server and Related Forums category; Hello: I am trying to create custom user directories using mod_rewrite with a CGI script. I am running Apache/1....


Go Back   Usenet Forums > Web Server and Related Forums > Linux Web Servers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-09-2005
SorceryKid the goth-boi
 
Posts: n/a
Default How to mod_rewrite user directories with a CGI?

Hello:

I am trying to create custom user directories using mod_rewrite with a
CGI script. I am running Apache/1.3.33 (Unix). I've added the following
rules to my httpd.conf file under the respective virtual host that they
apply to.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteOptions inherit
RewriteCond %{HTTP_HOST} ^www\.mysite\.com [OR]
RewriteCond %{HTTP_HOST} ^mysite\.com
RewriteRule ^/~([a-zA-Z0-9_]+)$ /services/homepage.cgi?$1 [L]
</IfModule>

The only problem is, even with UserDir explicitly disabled, Apache
somehow notices I am trying to usurp control over user directories with
a CGI, so apparently at some stage after the rewrite it looks back at
the original request-URL again and secretly issues a getpwnam command
(evidenced by the error_log output), thus denying the CGI script from
running because it can never find the appropriate username in the
password file.

This only happens if I try to do rewriting on URLs with a tilde and a
CGI script as the target. Keep in mind, I do have ExecCGI enabled for
the entire site under this virtual host. And, this all works just fine
if I rewrite to a .html file, for example.

I suppose my last resort is to simply move the rewrite into the
..htaccess file under my site's htdocs. But that is really more of a
kludge than a solution. What should I do?

TIA,

--Randall

  #2 (permalink)  
Old 04-10-2005
SorceryKid the goth-boi
 
Posts: n/a
Default Re: How to mod_rewrite user directories with a CGI?

I found the solution. Apparently by doing a PT (pass through) it
bypasses the internal user directory hook entirely. According to the
docs, PT is specifically designed to aid in cross-compatibility with
other URL-to-file translation mechanisms. It's likely the tilde's
special meaning to the operating system (not necessarily Apache itself)
is causing some point of internal confusion, so a pass-through is
necessary.

--Randall

 
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 07:53 AM.


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