karim Bendadda wrote:
Sorry but I'm a beginer on developping Apache modules...Thank you for your
patience...
I dont't understand this:
/* set a "Location:" header and 302 redirect. */
Does'it mean to make this??:
No, that is just a C comment.
<Location /my_module>
Redirect /my_module http://10.112.3.20/test
</Location>
This is a pre-build "hard coded" redirection module that does something
very similar to :
static int my_module_handler (request_rec *r){
/* assemble the url by appending the filename to a baseurl */
uri = apr_pstrcat(r->pool, "http://10.112.3.20/test", "my_module",
NULL);/*????*/
apr_table_setn(r->headers_out, "my_module", uri);
return HTTP_MOVED_TEMPORARILY;
}
However, you have two things that are wrong in your code. The resulting
uri would be "http://10.112.3.20/testmy_module" because the
apr_pstrcat() function tacks the two strings together. If you already
know the full URL, you can skip the uri= line and set the headers_out.
Which brings up the other issue. The apr_table_setn must be setting a
"Location" header in order to meet the redirection standard. Yours is
setting "my_module". Replace "my_module" with "Location", and then
whatever is in the uri parameter is going to the web browser as the
location header, and it should contact the new server/resource.
Joe
--
Joseph Lewis <http://sharktooth.org/>
"Divide the fire, and you will sooner put it out." - Publius Syrus