if ($QS_f eq '') {
print "HTTP/1.0 200 OK\n";
print "Content-type: text/html\n\n";
-print "<b>ERROR</b>: No file given\n";
+print "<b>ERROR</b>: No file given\n";
exit(0);
}
if (! -f $QS_f) {
print "HTTP/1.0 200 OK\n";
print "Content-type: text/html\n\n";
-print "&lt;b&gt;ERROR&lt;/b&gt;: File $QS_f not found\n";
+print "<b>ERROR</b>: File $QS_f not found\n";
exit(0);
}
local(*FP, $size, $buffer, $bytes);
($x, $x, $x, $x, $x, $x, $x, $size) = stat($file);
$size = sprintf("%d", $size);
-open(FP, "&lt;$file");
+open(FP, "<$file");
$bytes = sysread(FP, $buffer, $size);
close(FP);
return $buffer;
if ($QS_f eq '') {
print "HTTP/1.0 200 OK\n";
print "Content-type: text/html\n\n";
-print "&lt;b&gt;ERROR&lt;/b&gt;: No file given\n";
+print "<b>ERROR</b>: No file given\n";
exit(0);
}
if (! -f $QS_f) {
print "HTTP/1.0 200 OK\n";
print "Content-type: text/html\n\n";
-print "&lt;b&gt;ERROR&lt;/b&gt;: File $QS_f not found\n";
+print "<b>ERROR</b>: File $QS_f not found\n";
exit(0);
}
local(*FP, $size, $buffer, $bytes);
($x, $x, $x, $x, $x, $x, $x, $size) = stat($file);
$size = sprintf("%d", $size);
-open(FP, "&lt;$file");
+open(FP, "<$file");
$bytes = sysread(FP, $buffer, $size);
close(FP);
return $buffer;
log.</p>
<pre class="prettyprint lang-config">
-RewriteRule \.(png|gif|jpg) - [E=image:1]
+RewriteRule \.(png|gif|jpg)$ - [E=image:1]
CustomLog logs/access_log combined env=!image
</pre>
example, if you wanted all image requests to be handled by a back-end
image server, you might do something like the following:</p>
-<pre class="prettyprint lang-config">RewriteRule /(.*)\.(jpg|gif|png) http://images.example.com/$1.$2 [P]</pre>
+<pre class="prettyprint lang-config">RewriteRule /(.*)\.(jpg|gif|png)$ http://images.example.com/$1.$2 [P]</pre>
<p>Use of the [P] flag implies [L] - that is, the request is immediately
<pre class="prettyprint lang-config">
Alias /icons /usr/local/apache/icons
-RewriteRule /pics/(.+)\.jpg /icons/$1.gif [PT]
+RewriteRule /pics/(.+)\.jpg$ /icons/$1.gif [PT]
</pre>
RewriteRule .? - [S=3]
# IF the file exists, then:
- RewriteRule (.*\.gif) images.php?$1
- RewriteRule (.*\.html) docs.php?$1
- # Skip past the "else" stanza.
- RewriteRule .? - [S=1]
+ RewriteRule (.*\.gif) images.php?$1
+ RewriteRule (.*\.html) docs.php?$1
+ # Skip past the "else" stanza.
+ RewriteRule .? - [S=1]
# ELSE...
- RewriteRule (.*) 404.php?file=$1
+ RewriteRule (.*) 404.php?file=$1
# END
</pre>
log.</p>
<highlight language="config">
-RewriteRule \.(png|gif|jpg) - [E=image:1]
+RewriteRule \.(png|gif|jpg)$ - [E=image:1]
CustomLog logs/access_log combined env=!image
</highlight>
example, if you wanted all image requests to be handled by a back-end
image server, you might do something like the following:</p>
-<highlight language="config">RewriteRule /(.*)\.(jpg|gif|png) http://images.example.com/$1.$2 [P]</highlight>
+<highlight language="config">RewriteRule /(.*)\.(jpg|gif|png)$ http://images.example.com/$1.$2 [P]</highlight>
<p>Use of the [P] flag implies [L] - that is, the request is immediately
pushed through the proxy, and any following rules will not be
<highlight language="config">
Alias /icons /usr/local/apache/icons
-RewriteRule /pics/(.+)\.jpg /icons/$1.gif [PT]
+RewriteRule /pics/(.+)\.jpg$ /icons/$1.gif [PT]
</highlight>
<p>
RewriteRule .? - [S=3]
# IF the file exists, then:
- RewriteRule (.*\.gif) images.php?$1
- RewriteRule (.*\.html) docs.php?$1
- # Skip past the "else" stanza.
- RewriteRule .? - [S=1]
+ RewriteRule (.*\.gif) images.php?$1
+ RewriteRule (.*\.html) docs.php?$1
+ # Skip past the "else" stanza.
+ RewriteRule .? - [S=1]
# ELSE...
- RewriteRule (.*) 404.php?file=$1
+ RewriteRule (.*) 404.php?file=$1
# END
</highlight>