Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

mod_rewrite external redirect

apache windows mod_rewtrite



6:17 pm on Sep 10, 2003 (gmt 0)

Inactive Member
Account Expired


Has anyone successfully implemented an rewrite map to an external program using the built in functions of mod_rewrite?

I am attempting to use an external program for load balancing/failover but I am running into a strange problem. When the URL is rewritten, I get an access forbidden error - mod rewrite is proxying the request with an external %0D on the end.

We run Apache 2.0.43 on Windows, so I am unable to get a perl program to run (as called from Apache), so I've written a small program in C to provide the redirect.

My conf lines read like:

rewriteengine on
rewritelog /apache2/myapache/rw.log
rewriteloglevel 3
rewriterule ^/(.+)$${lb:$1}[P,L]

where pb.exe is an executable which, at this time, accepts the url on stdin and returns a url:

#include <iostream>

int main()

char ch[] = { "empty" };

while (ch)
std::cin >> ch;
std::cout << "http://wc-dev.healthsystem.virginia.edu/internet/index.html";

std::cout << std::endl;

return 0;

If this makes no sense to you, but you know of a program that works similarly or have a suggestion about how to make map:txt work, I would be grateful for your input.

4:24 pm on Sept 11, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Sept 21, 1999
votes: 0

Unfortunately, all I have to offer is a warm welcome to WebmasterWorld! :)

We've had very few discussions surrounding the RewriteMap directive. It seems not many here are overly familiar with it. Can anyone offer this new member any suggestions or advice? In other words: