httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Glencross <>
Subject [users@httpd] Strange rewrite behaviour on alternate hits?
Date Sun, 20 Apr 2003 12:37:42 GMT

Although I've been using Apache for CGI scripting for a few years, I'm a 
newbie on mod_rewrite.

What I was trying to do is make the web server effectively ignore the 
URL, and always run the same single CGI script.

mod_rewrite seems the best way to do this (correct me if I'm wrong!). 
I'm using the version that comes with apache-2.0.44 on gentoo.

I've added the following three Rewrite* commands to the <Directory /> 
section in commonapache2.conf.


<Directory />
   Options -All -Multiviews
   AllowOverride None

RewriteEngine on

RewriteCond %{REQUEST_URI} !/cgi-bin/hello$
RewriteRule .* /cgi-bin/hello?

   <IfModule mod_access.c>
     Order deny,allow
     Deny from all



For now, the CGI script is simply:


use CGI qw/:standard/ ;

print header () ;

print start_html ('Hello') ;

print "Hello from HTML!\n" ;

print end_html ;

and when you run it, you get

Content-Type: text/html; charset=ISO-8859-1

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
         PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="" 
</head><body>Hello from HTML!

So far so good, so regardsless of what url you enter, you get:

"Hello from HTML!"

BUT... then on the next hit have to wait a while and get

"0 HTTP/1.1 200 OK Date: Sun, 20 Apr 2003 12:30:35 GMT Server: 
Apache/2.0.44 (Gentoo/Linux) Keep-Alive: timeout=15, max=99 Connection: 
Keep-Alive Transfer-Encoding: chunked Content-Type: text/html; 
charset=ISO-8859-1 129 Hello from HTML! 0 0"

I see the timeout=15, and indeed there is roughly a 15 second wait.

Refresh, and things are ok. The problem seems to happen on alternate hits.

Now, if I browse "http://localhost/cgi-bin/hello" directly, there is 
never a problem, so it really does look as though it is rewrite specific.

Can anyone shed any light on why I'm experiencing this, and even better, 
provide a solution to what I'm trying to do.

Thanks in advance,

Nick Glencross

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message