mod_rewrite on Apache 1.3

I'm using the following in my /vnc/.htaccess

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.* - [L]
RewriteRule ^(.*)                        index.php?url=$1 [L]

Now What index.php does is take the requested URL and repeat the request on a different port (which is running my VNC service) and then returns the data. Specifically it'll pass back a couple of java files to the web browser which will run a remote VNC client.

I'm having to do all of this because at work I'm behind a VERY restrictive firewall which will only allow traffic on port 80. Since I want a webserver too, I have to use an alternative to serve the files - hence my attempt at this modification.

The problem - The URL passed to index.php is always lowercase.

When requesting /vnc/VncViewer.class
the URL passed to PHP is /vncviewer.class which (of course) returns a 404 error. If I change the capitalisation manually, it works of course.

In case it helps, my PHP is below: (it's rough, ready, has no error checking, and does not currently filter out the HTTP Response headers but they're all problems for a later time!)

//header("Content-Type: Text/Plain");
if(isset($_REQUEST['url'])) {
       $url="/" . $_REQUEST['url'];
print "<H1>Server $socketHost Port $socketNum - URL $url</H1>";

$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($socket < 0) {
   die("socket_create() failed: reason: " . socket_strerror($socket) . "\n");

$result = socket_connect($socket, $socketHost, $socketNum);
if ($result < 0) {
      die("socket_connect() failed.\nReason: ($result) " . socket_strerror($result) . "\n");

$in = "GET $url HTTP/1.1\r\n";
$in .= "Host: localhost\r\n";
$in .= "Connection: Close\r\n\r\n";
$out = '';

socket_write($socket, $in, strlen($in));

while ($out = @socket_read($socket, 2048)) {
//echo substr($response, $skipheader);
echo $response;


Ig anyone can PLEASE help (or even better, tell me a better way to do this!) I'd appreciate it. Thanks in advance
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

> The problem - The URL passed to index.php is always lowercase.

So you're on windows? Try to ue the rules in your httpd.conf, if your request goes into a virtual host, place the rules into that virtual host and remove the .htaccess file:

RewriteEngine on
RewriteCond /full/physical/path/to/vnc/$1 !-f
RewriteCond /full/physical/path/to/vnc/$1 !-l
RewriteCond /full/physical/path/to/vnc/$1 !-d
RewriteRule ^/vnc/(.*)  /vnc/index.php?url=$1 [L]

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
See Apache bugzilla

Especially the comments:

"  This is resolved in Apache 2.0 - Apache 1.3 simply lowercased the filenames
  to 'canonicalize' them to their "one true name".  Yes this was very hackish,
  but that's the Apache 1.3 on Windows solution - an interesting and clever hack.

  Apache 2.0 was written from the ground up - and this was taken into account.
  The file's *true names* are used in Apache 2.0 (as stored on disk as their
  long file names.)  Also the "one true name", this takes a few more cpu/disk
  cycles but is more reliable and doesn't cause the sorts of problems you are

  Please upgrade to 2.0 to resolve your issue."


"As I said 15 months ago - it is simply NOT possible to straighten this
out in Apache 1.3/Win32.  Nothing has changed, or will change, in that
answer.  If you don't like the behavior (certainly I don't :-) then
upgrade to 2.0."

caterham_www:  Just curious... I haven't tried out your solution, but wondering if the reasoning for moving it out of .htaccess is so that it doesn't go through the "add path-info postfix" and "strip per-dir prefix"?

No, performance is one reason but an other one here is: I think the converting to lowercase is caused by apr while the request is being mapped to the filesystem (uri-to-filepath translation). In per-server context you're on the uri level. So the rule should match against an URL-path which is hopefully in its original case in this step of processing.
basiclifeAuthor Commented:
Thank you all for the rapid responses. The Apache 1.3 machine is just a local windows XP setup that I use for testing and I haven't run across this problem before. I'm at work now so will read through this more closely when I get home and see what can be done (if anything!) maybe have to upgrade to 2.0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.